Modulo based genetic material alignment

ABSTRACT

A modulo based alignment system for aligning genetic material sequences is provided. The modulo based alignment system reduces the size of data required for the genetic material sequence alignment, reduces the number of the registers required for processing, reduces the power requirements, and reduces the amount of heat generated during processing. The modulo based alignment system provides methods of performing dynamic programs for global, overlapping and local alignments using modular arithmetic. The methods produce smaller parameters requiring fewer processor register bits. In addition, with customized hardware optimized for 8-bit arithmetic, the dynamic programs are sped up.

CLAIM OF BENEFIT TO PRIOR APPLICATIONS

This application claims the benefit of U.S. Provisional Patent Application Ser. No. 63/224,849, filed on Jul. 22, 2021. The contents of U.S. Provisional Patent Application 63/224,849 are hereby incorporated by reference.

BACKGROUND

Genetic material includes deoxyribonucleic acid (DNA), messenger ribonucleic acid (mRNA), proteins, genes, chromosomes, various types of data including nucleotide and amino acid sequences, etc. Sequencing of the genetic material involves revealing the order of bases present in the genetic material. During sequencing, often set of two or more sequences of genetic material are aligned. Sequence alignment is a way of arranging DNA, mRNA, or protein to identify regions of similarity that indicate functional, structural, or evolutionary relationship between the sequences.

Methods used for alignment are often computationally intensive due to the large-scale nature of genetic materials. Alignment methods are implemented using either a software running on a computer, or a software/firmware running on a specialized computer or a customized hardware. Often computational and memory (such as, register, cache, and page) requirements of these methods are high. Further, these high requirements demand high power and burden the speed of alignment.

BRIEF DESCRIPTION OF THE DRAWINGS

The various embodiments of the present modulo based genetic material alignment now will be discussed in detail with an emphasis on highlighting the advantageous features. These embodiments depict the novel and non-obvious modulo based genetic material alignment shown in the accompanying drawings, which are for illustrative purposes only. These drawings include the following figures, in which like numerals indicate like parts:

FIG. 1 illustrates an alignment digraph, according to various aspects of the present disclosure;

FIGS. 2A-2D illustrate dynamic programing on an alignment digraph, according to various aspects of the present disclosure;

FIG. 3 illustrates a CPU architecture, according to various aspects of the present disclosure;

FIG. 4A illustrates five 8-bit registers, according to various aspects of the present disclosure;

FIG. 4B illustrates a 64-bit registers with two 8-bit accessible 8-bit segments, according to various aspects of the present disclosure;

FIG. 4C illustrates storing data in the accessible portion of registers, according to various aspects of the present disclosure;

FIG. 5A illustrates a key recursion unit for the global alignment, according to the traditional approaches;

FIG. 5B illustrates a key recursion unit for the global alignment, based on residues, according to various aspects of the present disclosure;

FIG. 6 illustrates a hardware and software block diagram of the first embodiment, according to various aspects of the present disclosure;

FIG. 7 illustrates a CPU architecture with an accelerating unit, according to various aspects of the present disclosure;

FIG. 8 illustrates the diagonal vertices used in parallel processing, according to various aspects of the present disclosure;

FIG. 9 illustrates the hardware that implements the function F_(A) of the third embodiment, according to various aspects of the present disclosure;

FIG. 10 illustrates the hardware that implements the function F_(B) of the third embodiment, according to various aspects of the present disclosure;

FIGS. 11A and 11B illustrate the hardware that implements the function F_(E) of the third embodiment, according to various aspects of the present disclosure;

FIG. 12 illustrates parallel processing in the fourth embodiment, according to various aspects of the present disclosure;

FIG. 13 illustrates the hardware that implements the function F_(A) of the fifth embodiment, according to various aspects of the present disclosure;

FIG. 14 illustrates the hardware that implements the function F_(B) of the fifth embodiment, according to various aspects of the present disclosure;

FIG. 15 illustrates the hardware that implements the function F_(A) of the sixth embodiment, according to various aspects of the present disclosure;

FIG. 16 illustrates the hardware that implements the function F_(B) of the sixth embodiment, according to various aspects of the present disclosure;

FIG. 17 illustrates the hardware that implements the function F_(E) of the sixth embodiment, according to various aspects of the present disclosure;

FIG. 18 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 19 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 20 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 21 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 22 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 23 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 24 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 25 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 26 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 27 shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 28A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 28B shows a table that for each affine gap function, characterized whether the walk from the top circle (row>1 and column=2) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure;

FIG. 29A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 29B shows a table that for each affine gap function, characterized whether the walk from the top circle (row>1 and column>2) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure;

FIG. 30A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=2, such that one ends in A and the other ends in B according to various aspects of the present disclosure;

FIG. 30B shows a table that for each affine gap function, characterized whether the walk from the top circle (row=1 and column=2) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function according to various aspects of the present disclosure;

FIG. 31A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 31B shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>2, such that one ends in A and the other ends in A, according to various aspects of the present disclosure;

FIG. 32A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 32B shows a table that for each affine gap function, characterized whether the walk from the top circle (row>1 and column=1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure;

FIG. 33A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 33B shows a table that for each affine gap function, characterized whether the walk from the top circle (row=1 and column=1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure;

FIG. 34A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 34B shows a table that for each affine gap function, characterized whether the walk from the top circle (row=0 and column=0) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure;

FIG. 35A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 35B shows a table that for each affine gap function, characterized whether the walk from the top circle (row=1 and column>1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure;

FIG. 36A gives a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure;

FIG. 36B gives a table that for each affine gap function, characterized whether the walk from the top circle (row=0 and column=1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure;

FIG. 37A shows a table that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure; and

FIG. 37B shows a table that for each affine gap function, characterized whether the walk from the top circle (row=0 and column=0) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure.

DETAILED DESCRIPTION

One aspect of the present embodiments includes the realization that the existing methods of sequencing genetic material are often computationally intensive and memory intensive. Further, these high requirements demand high power and burden the speed of alignment. For example, DNA may include billions of bases and the alignment of two DNA sequences may require maintaining and processing large matrixes.

The present embodiments, as described in detail below, solve the above-mentioned problems by providing a modulo based genetic alignment system that reduces the size of data required for the alignment, reduces the number of the registers required for processing, reduces the power requirements, and reduces the amount of heat generated during processing.

The present embodiments provide methods of performing dynamic programs for global, overlapping and local alignments using modular arithmetic. The methods produce smaller parameters requiring fewer processor register bits. In addition, with customized hardware optimized for 8-bit arithmetic, the dynamic programs are sped up.

The remaining detailed description describes the present embodiments with reference to the drawings. In the drawings, reference numbers label elements of the present embodiments. These reference numbers are reproduced below in connection with the discussion of the corresponding drawing features.

I. Genetic Material Alignment A. Definitions

A sequence, x=x₁ x₂ x₃ . . . x_(n), of a genetic material over a genetic base alphabet

is a finite string of letters, each chosen from the alphabet

. A gap character, “-”, “-”∉

is used to signify an absent letter. An expanded sequence x′ of the sequence x is x with an arbitrary number of gap characters inserted at its beginning, end, or between any two of its characters.

An alignment of two sequences x and y of genetic materials is any pair of expanded sequences x and y′ such that (1) length (x′)=length (y′) and (2) {locations of the gaps in x′}∩{locations of the gaps in y′}=ϕ, i.e., the intersection of the set of the locations of the gaps of x′ and the set of the locations of the gaps of y′ is empty.

The 2×k matrix,

${M = \begin{bmatrix} \underline{x^{\prime}} \\ \underline{y^{\prime}} \end{bmatrix}},$ is referred to as the alignment matrix of the sequences x and y. Given sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m), a 2×1 vector is referred to as a substitution if it is of the form

$\begin{pmatrix} x \\ y \end{pmatrix},$ for x and y in

, an x-gap if it is of the form

$\begin{pmatrix} x \\ \text{“\_”} \end{pmatrix},$ for x in

, or a y-gap if it is of the form

$\begin{pmatrix} \text{“-”} \\ y \end{pmatrix},$ for y in

. A substitution,

$\begin{pmatrix} x \\ y \end{pmatrix},$ is referred to as a match if x=y, and it is called a mismatch if x≠y.

Given sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m) over the alphabet

, four sets:

_(y) ^(x),

⁻ ^(x),

_(y) ⁻, and

are defined as follows:

${{\mathbb{Z}}_{y}^{x} = \left\{ {\begin{pmatrix} x \\ y \end{pmatrix}:{{x{and}y} \in {\mathbb{Q}}}} \right\}},$ and is called the substitution set,

${{\mathbb{Z}}_{-}^{x} = \left\{ {{\begin{pmatrix} x \\ \text{“-”} \end{pmatrix}:{x \in {\mathbb{Q}}}},{{and}\text{“-”}{is}{the}{gap}{charactor}}} \right\}},$ and is called the x-gap set,

${{\mathbb{Z}}_{y}^{-}\left\{ {{\begin{pmatrix} \text{“-”} \\ y \end{pmatrix}:{y \in {\mathbb{Q}}}},{{and}\text{“-”}{is}{the}{gap}{charactor}}} \right\}},$ and is called the y-gap set, and

=

_(y) ^(x)∪

⁻ ^(x)∪

_(y) ⁻, and it is called the column space of alignment matrices.

B. Alignment Digraph

For every pair of sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m), there is a digraph D(x,y) that characterizes their alignments. Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}. An arc from (i₁,j₁)∈

to (i₂,j₂)∈

is denoted by either (i₁,j₁)→(i₂,j₂) or a shorter notation (i₁,j₁)(i₂,j₂). A digraph (or directed graph) is a graph that is made of a set of vertices that are connected by directed edges (or arcs), where each edge is an ordered pair of two vertices.

The horizontal arc set of D(x,y) is A^(h)={(i,j)(i+1,j) for, 0≤i≤n−1, and 0≤j≤m}. The set A^(h) includes all horizontal arcs of D(x,y). The vertical arc set of D(x,y) is A^(v)={(i,j)(i,j+1) for, 0≤i≤n, and 0≤j≤m−1}. The set A^(v) includes all vertical arcs of D(x,y). And the diagonal arc set of D(x,y) is A^(d)={(i,j)(i+1,j+1) for, 0≤i≤n−1, and 0≤j≤m−1}. The set A^(d) includes all diagonal arcs of D(x,y).

Clearly, the sets A^(h), A^(v), and A^(d) are pairwise disjoint. A^(h)∩A^(v)=A^(h)∩A^(d)=A^(v)∩A^(d)=ϕ. The arc set of D(x,y) is

=A^(h)∪A^(v)∪A^(d).

FIG. 1 illustrates an alignment digraph 100, according to various aspects of the present disclosure. The digraph 100 corresponds to a pair of sequences x=x₁ x₂ x₃ x₄ and y=y₁ y₂ y₃, n=4, m=3. In order to identify the columns of the digraph 100 with the sequence x=x₁ x₂ x₃ x₄ an auxiliary base is augmented to x, in the beginning. The auxiliary base is typically set to ‘0’ and is not in the genetic base alphabet,

, of x. Similarly, in order to identify the rows of the digraph 100 with the sequence y=y₁ y₂ y₃ the auxiliary base is augmented to y, in the beginning. The augmented sequence become x=(0 x₁ x₂ x₃ x₄) and y=(0 y₁ y₂ y₃).

Lemma 1: There is a 1-to-1 correspondence between, the alignments of sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m), and directed walks from (0,0) to (n, m) on D(x,y). A directed walk is a sequence of edges directed in the same direction which joins a sequence of vertices. The proof for Lemma 1 is as follows:

1) define a map F:

→

. F is referred to as the “

to

” map

For every arc (i,j)(p,q)∈

,

${F\left( {\left( {i,j} \right)\left( {p,q} \right)} \right)}\overset{\Delta}{=}\left\{ \begin{matrix} \begin{pmatrix} x_{p} \\ y_{q} \end{pmatrix} & {{{{if}\ \left( {i,j} \right)}\left( {p,q} \right)} \in A^{d}} \\ \begin{pmatrix} x_{p} \\ \text{“-”} \end{pmatrix} & {{{{if}\ \left( {i,j} \right)}\left( {p,q} \right)} \in A^{h}} \\ \begin{pmatrix} \text{“-”} \\ y_{q} \end{pmatrix} & {{{if}\ \left( {i,j} \right)\left( {p,q} \right)} \in A^{v}} \end{matrix} \right.$

2) based on F, define a map

from walks to alignment matrices

3) show the map

is 1-to-1

4) show the map

is onto (that is to show for every alignment matrix, M, there is a walk, W, such that

(W)=M).

C. Introduction

In a first medical application example, one might have two sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m) of genetic materials collected from a cancer patient before and after use of a medication, respectively. To understand the effect of the mediation on the patient in the genetic level, the two sequences may be compared. The medication might have caused a letter in sequences x to change into another letter, a letter in sequences x to be eliminated, and/or a letter to be inserted in sequences x. A best comparison would reveal all these changes from x to y.

FIG. 2A illustrates dynamic programing on an alignment digraph, according to various aspects of the present disclosure. With reference to FIG. 2A, to make a comparison, first an alignment (comparison) diagraph 150 is generated based on the sequences x and y. The vertices are (i,j) for 0≤i≤n and or 0≤j≤m. As shown in FIG. 2A, from the vertex (i,j), there are 3 arcs to (i+1,j), (i,j+1), and (i+1,j+1), boundary conditions allowing.

Each possible walk from (0,0) to (n, m) corresponds to a comparison of sequences x and y. A score may be calculated for each walk. The score is a measure of how well the walk characterizes (e.g., identifies) the difference in the sequences. The present embodiments provide a system that searches for a walk with the best score, the one that gives the best characterization (e.g., the best identification) of the differences. Some embodiments perform dynamic programing to do the search. Dynamic programming refers to simplifying a complicated problem by breaking it down into simpler sub-problems in a recursive manner.

In the example of FIG. 2A, for every (i,j) in the diagraph 150, E(i,j) is the best score over all walks from (0,0) to (i,j). A(i,j) is the best score over all walks from (0,0) to (i,j) that ends with a vertical arc. B(i,j) is the best score over all walks from (0,0) to (i,j) that ends with a horizontal arc.

Using a dynamical program, E(i,j) may be generated based on E(i−1,j−1), E(i−1,j), E(i,j−1), A(i,j−1), and B(i−1,j). A(i,j) may be generated based on E(i,j−1) and A(i,j−1), and B(i,j) may be generated based on E(i,j−1) and B(i−1,j).

Parameters A, B, and C may be stored as binary numbers of lengths 32, 64, 128, or more. In practice, the length of sequences x and y could be in thousands. This puts a heavy burden on storage. When a processor (also referred herein as a central processing unit, or CPU) is used to implement the dynamical program, the CPU registers are used to store the parameters. Furthermore, in order to have a fast process, it is desirable to use the fast registers of the CPU to store the parameters. This puts a burden on the availability of the fast registers of the CPU.

In other problems with such demands, the parameters may be quantized to have length 8 bits or 16 bits to reduce the storage requirement. For example, in artificial intelligence and deep learning, the parameters may be quantized to 8 bits to reduce the storage and to speed up the process. However, quantization is not desirable for processes of alignments of genetic materials because quantization introduces loss of accuracy, which is important to medical, criminal and other application.

In some of the systems of the present embodiments the dynamic program runs on residues of the parameters modulus M, instead of the parameters themselves. FIG. 2B illustrates dynamic programing on an alignment digraph using parameters modulus instead of the parameters themselves, according to various aspects of the present disclosure. In many practical applications the residues are small, requiring only 8 bits while the parameters are 16 bits, 32 bits, or more. A typical CPU register size is 64 bits. Using the single-instruction multiple-data (SIMID) operations, in many CPUs in modular methods of the present invention, 1) the calculation of the dynamic program may be accelerated, and 2) the demand for a large number of registers may be reduced. The methods of the present embodiments are lossless and solve the storage problems without sacrificing accuracy.

In a second medical application example, two sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m) of genetic materials are collected. The goal in this example is not to find an alignment of the whole sequences x and y, as was in the first medical application described above. Instead, the goal is to find a stretch of x and a stretch of y that are most similar over all possible stretches.

FIG. 2C illustrates further details of a dynamical program used to solve the problem shown in FIG. 2B, according to various aspects of the present disclosure. First, the parameters A(i,j), B(i,j), and E(i,j) are computed as before, then any parameter that is less that zero is replaced by zero before it is used for another vertex. This method has the same problem as before, large demand on storage.

FIG. 2D illustrates further details of a dynamical program that runs on modulus and quotients of the parameters, according to various aspects of the present disclosure. With respect to FIG. 2D, the dynamic program may run on the residues of the parameters modulus M, and the quotients of the parameters modulus M, where for X∈{A, B, E}, quotient of X, KX=K″X+K′X, where K″X is a small number, and K″X is the major portion of KX.

Similar saving in storage from storing the residues of the parameters is achieved as before but store K″X and K′X values have to be stored. The method of FIG. 2D provides the following technical advantages: The K′X values do not need fast registers to be stored since they are slow changing values, and the K″X values are small. Therefore, the demand on fast registers is reduced.

In most applications like criminal investigation application and DNA sequencing, there are many (e.g., hundred, thousands, millions) pieces of sequences involves that need to be aligned and the dynamical program is repeated many times. Therefore, any improvement of the dynamical program benefits most applications significantly.

Further details of the systems and methods of the present embodiment are described below with reference to six exemplary embodiments. The first embodiment demonstrates the modular based dynamical program using a CPU and software for global alignment. The second embodiment demonstrates the modular based dynamical program using a software and/or firmware running on a specialized computer for global alignment. The third embodiment demonstrates the modular based dynamical program using a customized hardware for global alignment.

The fourth embodiment demonstrates the modular based dynamical program using a customized hardware in a parallel processing setting for global alignment. The fifth embodiment demonstrates the modular based dynamical program using a customized hardware for an overlapping alignment with affine gap score. The sixth embodiment demonstrates the modular based dynamical program using a customized hardware for a local alignment with affine gap score.

D. Scoring a Walk on Digraph D(x,y)

Given sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m) over alphabet

, the x and y alignment digraph, D(x,y), with vertex set

, and a walk W=((i₀,j₀), (i₁,j₁), . . . , (i_(l),j_(l))) starting on a vertex (i₀,j₀)∈

and ending on a vertex (i_(l),j_(l))∈

, the score of the walk W is:

S _(W)=({circumflex over (φ)}₀(ω₁)+Σ_(t=2) ^(l) {circumflex over (φ)}₁(ω_(t−1), ω_(t)), where ω_(t)=(i_(t−1),j_(t−1))(i_(t),j_(t)), for integer t, 1≤t≤l, and maps {circumflex over (φ)}₀ and {circumflex over (φ)}₁ are described in Table 1 below using a map, κ, and parameters: h, v, h_(d), v_(d), h_(h), v_(h), h_(v), and v_(v). Rows numbered 1-3 in Table 1 show the map {circumflex over (φ)}₀(ω₁) and rows numbered 4-10 show the map {circumflex over (φ)}₁(ω_(t−1), ω_(t)).

TABLE 1 ω₁ {circumflex over (φ)}₀(ω₁) 1 ω₁ ∈ A^(d) κ(x_(i) ₁ , y_(j) ₁ ) 2 ω₁ ∈ A^(h) h 3 ω₁ ∈ A^(v) v (ω_(t−1), ω_(t)) {circumflex over (φ)}₁(ω_(t−1), ω_(t)) 4 ω₂ ∈ A^(d) κ(x_(i) _(t) , y_(j) _(t) ) 5 ω₁ ∈ A^(d) h_(d) ω₂ ∈ A^(h) 6 ω₁ ∈ A^(h) h_(h) ω₂ ∈ A^(h) 7 ω₁ ∈ A^(v) h_(v) ω₂ ∈ A^(h) 8 ω₁ ∈ A^(d) v_(d) ω₂ ∈ A^(v) 9 ω₁ ∈ A^(h) v_(h) ω₂ ∈ A^(v) 10 ω₁ ∈ A^(v) v_(v) ω₂ ∈ A^(v)

κ is a map, κ:

×

→

such that κ(c, d), is the value (or score) of the substitution

$\begin{pmatrix} c \\ d \end{pmatrix},$ for c∈

and d∈

. The map κ is called the substitution value map. (match if a=b, mismatch if a≠b). Table 2 shows the parameters h, v, h_(d), v_(d), h_(h), v_(h), h_(v), and v_(v).

TABLE 2 h value of an x-gap v value of an y-gap h_(d) value of an x-gap that follows a substitution v_(d) value of an y-gap that follows a substitution h_(h) value of an x-gap that follows a x-gap v_(h) value of an y-gap that follows a x-gap h_(v) value of an x-gap that follows a y-gap v_(v) value of an y-gap that follows a y-gap

The maps {circumflex over (φ)}₀ and {circumflex over (φ)}₁ closely fit experimental statistics without being computationally prohibitive. The maps {circumflex over (φ)}₀ and {circumflex over (φ)}₁ include the following features. The substitution value matrix, κ, and constants: h, v, h_(d), v_(d), h_(h), v_(h), h_(v), and v_(v) may be split into two parts: 1) the matrix, κ, that scores the substitutions and 2) the constants (referred to herein as gap score constants) h, v, h_(d), v_(d), h_(h), v_(h), h_(v), and v_(v) that score the gaps.

In alignment literature, several settings may be used for the constants. An uncomplicated setting is assigning a fixed score, g, to all constants. Such a setting is referred to as a linear gap setting. Linear gap setting woks well when the experimental results show a linear relationship between score of a run of gaps and the length of the run. But it does not work well when a lower score is desirable for the first gap of the run than for the rest of the gaps in the run.

E. Three Main Alignment in Bioinformatics

There are three main alignments of two sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m) in bioinformatics, the global alignment, the local alignment, and the overlap alignment. In the global alignment, the emphasis is on walks on D(x,y) that start from vertex (0,0) and end on vertex (n, m). In the local alignment, the emphasis is on walks on D(x,y) that start from vertex (0,0) and end on vertex (n, m) that contain an “optimum” sub-walk. In the overlap alignment, the emphasis is on walks on D(x,y) that start from a vertex on the top row or leftmost column and end on a vertex on the bottom row or the rightmost column.

F. Global Alignment

1. The Goal of the Global Alignment

Given two sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m), the x and y alignment digraph D(x,y) with vertex set

, and the score maps {circumflex over (φ)}₀ and φ₁, the goal of the global alignment is as follows.

Find a walk, W^(max), starting from vertex (0,0) and ending on vertex (n, m) on the alignment digraph D(x,y), such that W^(max)=((i₀,j₀)=(0,0), (i₁,j₁), . . . , (i_(k),j_(k))=(n, m)), has a maximal score.

More specifically, the goal of the global alignment is to find

${W^{\max} = {\underset{W:{W \in {\mathbb{W}}_{({0,0})}^{({n,m})}}}{\arg\max}{\overset{¯}{S}}_{W}}},$ where

_((0,0)) ^((n,m)){W: W is a walk on D(x,y) from (0,0) to (n, m)} and S _(W)={circumflex over (φ)}₀((i₀,j₀)(i₁,j₁))+Σ_(t=2) ^(k){circumflex over (φ)}₁((i_(t−2),j_(t−2))(i_(t−1),j_(t−1)), (i_(t−1),j_(t−1))(i_(t),j_(t))).

The score functions {circumflex over (φ)}₀ and {circumflex over (φ)}₁ are as defined earlier. It is further assumed that an affine gap score is used. The affine gap score is defined in Table 3, where α and β are nonnegative real numbers.

TABLE 3 v −β − α h −β − α h_(v) −β − α h_(d) −β − α h_(h) −β v_(v) −β v_(d) −β − α v_(h) −β − α

Now, W^(max) may be generated using a dynamical program, defined in “An Improved Algorithm for Matching Biological Sequences”, Osamu Gotoh, J. Mol. Biol. (1982) 162, 705-708, the contents of which are incorporate, herein, by reference.

It should be noted that an alignment digraph D(x,y) is not a trellis. A trellis is digraph D=(V, E), V is the vertex set of D, and E is the edge set of D with the property that, given any two vertices v and v′ in V, if there is a path of length n from v to v′ in D, then every path from v to v′ in D has length n. For example, in FIG. 1 , there are three paths in the digraph D(x,y) 100 from vertex (0,0) to (1,1), one is of length one, P₁=((0,0)(1,1)), and two are of length two, P₂=((0,0)(0,1)(1,1)) and P₂=((0,0)(1,0)(1,1)).

For every (i,j) in the diagraph 150 of FIG. 2A, E(i,j) is the best score over all walks from (0,0) to (i,j). A(i,j) is the best score over all walks from (0,0) to (i,j) that ends with a vertical arc. If no such walk exists, then A(i,j)=−Inf, where Inf denotes a large number. B(i,j) is the best score over all walks from (0,0) to (i,j) that end with a horizontal arc. If no such walk exists, then B(i,j)=−Inf.

Now, using a dynamical program, E(i,j) may be generated based on E(i−1,j−1), E(i−1,j), E(i,j−1), A(i,j−1), and B(i−1,j). A(i,j) may be generated based on E(i,j−1) and A(i,j−1), and B(i,j) may be generated based on E(i−1,j) and B(i,j−1).

The following initialization may be performed: E(0,0)=0 E(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0 A(0,0)=−Inf A(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0 B(0,0)=−Inf B(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0

The key recursion equations are as follows:

(i, j) ≠ (0, 0) ${E\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {{i - 1},{j - 1}} \right)} + {\kappa\left( {x_{i},y_{j}} \right)}} \\ {A\left( {i,j} \right)} \\ {B\left( {i,j} \right)} \end{matrix} \right.}$ ${A\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {i,{j - 1}} \right)} + v} \\ {{A\left( {i,{j - 1}} \right)} + v_{v}} \end{matrix} \right.}$ ${B\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {{i - 1},j} \right)} + h} \\ {{B\left( {{i - 1},j} \right)} + h_{h}} \end{matrix} \right.}$

The key recursion equations are computed for the vertices on the top row of the digraph D(x,y) 150, from (1,0) to (n, 0), next it is repeated for the vertices on the second row from (0,1) to (n, 1), then repeated for the vertices on the third row, etc.

Now, E(n, m) is the score, S _(W) _(max) , of W^(max), a walk of maximal score. To find W^(max) a path of choices may be found that the key recursion equations made to generate the score. This process is called a traceback. Trackback is based on variables I_(A(i,j)), I_(B(i,j)), and I_(E(i,j)), which are the indices to the maximal elements in in A(i,j) in B(i,j) in E(i,j) equations, respectively.

Often, the global alignment with affine gap score is implemented using (1) a software running on a central processing unit (CPU) or (2) a software/firmware running on a specialized computer or a customized hardware. Further, often, the values: E, A, and B are held in the CPU registers, caches, etc. during the computation of the key recursion equation.

2. The First Embodiment—The Modular Based Dynamical Program Using a CPU and Software for Global Alignment

In the first embodiment of modulo based, genetic material alignment methods, the global alignment is implemented using a software running on a CPU. FIG. 3 illustrates a CPU architecture, according to various aspects of the present disclosure. With reference to FIG. 3 , the CPU 200 may be connected to one or more computer readable media 210 (e.g., volatile memory and non-volatile memory) 210, input devices 220, and output devices 230. The CPU 200 may include a control unit 240 and an arithmetic-logic unit (ALU) 250. The ALU 250 may include a combinational logic 260 and several processor registers 270. The processor registers 270 may comprise a plurality of digital registers that are quickly accessible to the CPU 190. The computer readable media 210 may hold data and executable instructions. The control unit 240 may receive instructions from the computer readable media 210. Some of the instructions may pertain to one or more of the followings: receiving an input from an input device 220, sending an output to an output device 230, retrieving data from the computer readable media 210, performing arithmetic and logic operations on the received data using the combinatorial logic 260 and the registers unit 270 of the ALU 250.

The computer readable media 210 may be non-transitory computer readable media. The computer readable media 210 may include different types of memory units, such as, read-only-memory, volatile read-and-write memory, and/or non-volatile read-and-write memory. The read-only-memory may store static data and instructions that are needed by the processor 195. The non-volatile read-and-write memory may store instructions and data even when the power to the non-volatile memory is off. Some embodiments may use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive) as the non-volatile read-and-write memory.

The volatile read-and-write memory device may be random access memory and may be used as system memory. The system memory may store some of the instructions and data that the processor needs at runtime. In some embodiments, the processes of the present embodiments may be stored in the system memory, the non-volatile memory, and/or the read-only memory. From these various memory units, the ALU 250 may retrieve instructions to execute and data to process in order to execute the processes of some embodiments.

The registers 270 may include an assortment of digital registers of varying lengths, for example 16-bit, 32-bit, 64-bit, etc. Data may be loaded from computer readable media 210 into registers 270 where the data may be used by the CPU 195 for arithmetic and/or logic operations and may manipulated by machine instructions (e.g., the low level programming instructions).

In general, a CPU or a microprocessor has a native or a default register length, which is used much of the time, unless instructed otherwise. Usually, the default register length is specified with the name of the CPU or the microprocessor, for example 32-bit CPU, or 64-bit microprocessor.

During the computation of the key equations of the global alignment with affine gap score, the CPU 200 uses its registers in the registers unit 270 to hold the values: E, A, and B, described above.

In order to explain an important part of the present embodiments, the modulo operation is defined as follows. For any integer n, and a positive integer

, there is a unique integer r in {0, 1, . . . ,

−1} such that n≡r mod

. (≡ denotes congruency). Then r is called the residue of n modulo m, and equivalently n mod

. One may find the residue of a number n by taking the remainder when dividing by

. The notation r=res(n,

) may also be used.

Lemma 7.1: For integers p and q, 1≤p≤q≤5, |Q_(p)−Q_(q)|≤Q, where Q ₁(i,j)

D(i−1,j−1)+κ(x _(i) ,y _(j)) Q ₂(i,j)

D(i,j−1)+v Q ₃(i,j)

A(i,j−1)+v _(v) Q ₄(i,j)

D(i−1,j)+h Q ₅(i,j)

B(i−1,j)+h _(h) and LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)}, and Q=max{abs(LB),UB}}

Proof of Lemma 7.1 is described below.

Lemmas 7.1, 7.2 and 7.3 play major roles in the present embodiments. They state that differences between pairs of terms for integers p and q, 1≤p≤q≤5, the absolute difference |Q_(p)−Q_(q)| is bounded by Q, and the bound is independent of the length of the sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m), for global, overlapping and local alignments, respectively. Together with Lemma 10, they enable comparing Q_(p)(i,j) and Q_(q)(i,j) based on their residues modulus

.

The next lemma shows that if

≥2Q+1, then for every p and q, 1≤p<q≤10, Q_(p) and Q_(q) may be compared using r_(p) and r_(q).

Lemma 10: There are two integers U and V such that −W≤U−V≤+W for some positive integer W. Let r_(U) and r_(V) be the residues of U and V mod

=2W+1+Z, where Z is a non-negative integer. U=k _(U) ·

+r _(U),0≤r _(U)<

, and V=k _(V) ·

+r _(V),0≤r _(V)<

.

Then,

$\begin{matrix} \left\{ \begin{matrix} {U > V} & {and} & {{k_{U} - k_{V}} = 0} & {{{if}\ r_{V}} < r_{U} \leq {r_{V} + W}} \\ {U < V} & {and} & {{k_{U} - k_{V}} = {- 1}} & {{{{if}\ r_{V}} + W} < r_{U}} \\ {U < V} & {and} & {{k_{U} - k_{V}} = 0} & {{{if}\ r_{U}} < r_{V} \leq {r_{U} + W}} \\ {U > V} & {and} & {{k_{U} - k_{V}} = 1} & {{{{if}\ r_{U}} + W} < r_{V}} \\ {U = V} & {and} & {{k_{U} - k_{V}} = 0} & {{{if}\ r_{U}} = r_{V}} \end{matrix} \right. & {{Equation}(l)} \end{matrix}$

Proof: U−V=(k _(U) −k _(V))*(2W+1+Z)+r _(U) −r _(V)

Proof of Line 1 of Equation (1)

if r_(U)≤r_(V)+W, then: −W≤U−V=(k _(U) −k _(V))*(2W+1+Z)+r _(U) −r _(V)≤(k _(U) −k _(V))*(2W+1+Z)+r _(V) +W−r _(V)=(k _(U) −k _(V))*(2W+1+Z)+W

Thus (k_(U)−k_(V))≥0

But if r_(V)<r_(U), then +W≥U−V=(k _(U) −k _(V))*(2W+1+Z)+r _(U) −r _(V)>(k _(U) −k _(V))*(2W+1+Z)

leading to (k_(U)−k_(V))≤0

Thus, k_(U)−k_(V)=0.

Therefore, if r_(V)<r_(U)≤r_(V)+W then U>V and k_(U)−k_(V)=0.

Proof of Line 2 of Equation (1)

if r_(V)+W<r_(U), then +W≥U−V=(k _(U) −k _(V))*(2W+1+Z)+r _(U) −r _(V)>(k _(U) −k _(V))*(2W+1+Z)+r _(V) +W−r _(V)=(k _(U) −k _(V))*(2W+1+Z)+W

Thus (k_(U)−k_(V))≤−1.

But if (k_(U)−k_(V))≤−2 then: −W≤U−V=(k _(U) −k _(V))*(2W+1+Z)+r _(U) −r _(V)≤−2*(2W+1+Z)+r _(U) −r _(V)≤−2*(2W+1+Z)+W=−3W−2−Z

Thus (k_(X)−k_(Y))=−1

Therefore, if r_(V)+W<r_(U) then U<V and k_(U)−k_(V)=1

Proof of Line 3 of Equation (1) is similar to the proof of Line 1, described above.

Proof of Line 4 of Equation (1) is similar to the proof of Line 2, described above.

Proof of Line 5 of Equation (1)

If r_(U)=r_(V), then U−V=(k_(U)−k_(V))·

=(k_(U)−k_(V))·(2W+1+Z). But −W≤U−V≤+W, hence k_(U)=k_(V), and U=V.

Corollary 1, to Lemma 10: The index variables of traceback: I_(A(i,j)), I_(B(i,j)), and I_(E(i,j)) may be computed based on residues of Q₁-Q₅. As discussed in the examples below, frequently it requires smaller registers to hold the residues than Q₁-Q₅.

Corollary 2, to Lemma 10:

and W may be picked such that

=2^(ω) and W=2^(ω−1)−1, for some ω. These selections ease the hardware implementation of the alignment system of the present embodiment. In addition, they allow a faster software implementation.

In general, if −LB≠UB, then the values Q₁-Q₅ may be shifted by δQ=[(UB+LB)/2], for 1≤p≤5, Q′_(p)=Q_(p)−δQ. Where ┌x┐ denotes the smallest integer greater than or equal to x. Such shifts often reduce the number of bits needed to represent Q′₁-Q′₅.

This would result a smaller Q and a smaller

, and fewer bits to represent and store Q ₁-Q ₅. LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)},

There are 3 main equations in the key recursion equations in global alignment. Each equation requires finding a maximal element of a set.

1) A(i,j) equals a maximal element of a set Set_(A(i,j))={E(i,j−1)+v, A(i,j−1)+v_(v)}

2) B(i,j) equals a maximal element of Set_(B(i,j))={E(i−1,j)+h, B(i−1,j)+h_(h)}

3) E(i,j) equals a maximal element of Set_(E(i,j))={E(i−1,j−1)+K(x_(i),y_(j)), A(i,j), B(i,j)}

Let res(A(i,j−1),

), res(B(i−1,j),

), res(E(i,j−1),

), res(E(i−1,j),

), res(E(i−1,j−1),

), res(A(i,j−1)+v _(v),

), res(B(i−1,j)+h _(h),

), res(E(i,j−1)+v,

), res(E(i−1,j)+h,

), and res(E(i−1,j−1)+κ(x _(i) ,y _(j)),

),

to denote the residues of A(i,j−1), B(i−1,j), E(i,j−1), E(i−1,j), E(i−1,j−1), A(i,j−1)+v_(v), B(i−1,j)+h_(h), E(i,j−1)+v, E(i−1,j)+h, and E(i−1,j−1)+κ(x_(i),y_(j)), respectively, with respect to a modulus

.

To simplify notation, let's define R₁-R₅ and r₁-r₅ as follows: R ₁ =A(i,j−1)+v _(v) R ₂ =E(i,j−1)+v R ₃ =B(i−1,j)+h _(h) R ₄ =E(i−1,j)+h R ₅ =E(i−1,j−1)+κ(x _(i) ,y _(j)) r ₁=res(A(i,j−1)+v _(v),

), r ₂=res(E(i,j−1)+v,

), r ₃=res(B(i−1,j)+h _(h),

), r ₄=res(E(i−1,j)+h,

), r ₅=res(E(i−1,j−1)+κ(x _(i) ,y _(j)),

).

For global alignment, the present disclosure gives the following 3 functions, F_(A), F_(B), and F_(E) for generating [res(A(i,j),

),I _(A(i,j)) ]=F _(A)(res(A(i,j−1),

),res(E(i,j−1),

))) [res(B(i,j),

),I _(B(i,j)) ]=F _(B)(res(B(i−1,j),

),res(E(i−1,j),

))) [res(E(i,j),M),I _(E(i,j)) ]=F _(E)(res(E(i−1,j−1),

),res(A(i,j),

),res(B(i,j),

)) Where, A(i,j)=k _(A(i,j))×

+res(A(i,j),

),0≤res(A(i,j),

)<

B(i,j)=k _(B(i,j))×

+res(B(i,j),

),0≤res(B(i,j),

)<

E(i,j)=k _(E(i,j))×

+res(E(i,j),

),0≤res(E(i,j),

)<

I_(A(i,j)) is the index to the maximal element in Set_(A(i,j)), that is I_(A(i,j))=1 if the first element in Set_(A(i,j)) is the maximal element, I_(A(i,j))=2 if the second element in Set_(A(i,j)) is the maximal element, etc.

I_(B(i,j)) is the index to the maximal element in Set_(B(i,j)),

I_(E(i,j)) is the index to the maximal element in Set_(E(i,j)).

I_(A(i,j)), I_(B(i,j)), and I_(E(i,j)) are stored for traceback.

Now F_(A) decides on max {R₁, R₂}, based on {r₁, r₂} using the conditions of Lemma 10.

Conditions of the Lemma 10:

$\left\{ \begin{matrix} {R_{1} > R_{2}} & {{{if}r_{2}} < r_{1} \leq {r_{2} + Q}} \\ {R_{1} < R_{2}} & {{{{if}r_{2}} + Q} < r_{1}} \\ {R_{1} < R_{2}} & {{{if}r_{1}} < r_{2} \leq {r_{1} + Q}} \\ {R_{1} > R_{2}} & {{{{if}r_{1}} + Q} < r_{2}} \\ {R_{1} = R_{2}} & {{{if}r_{1}} = r_{2}} \end{matrix} \right.$

And F_(B) decides on max {R₃, R₄}, based on {r₃, r₄} using the conditions of Lemma 10.

Conditions of the Lemma 10:

$\left\{ \begin{matrix} {R_{3} > R_{4}} & {{{if}\ r_{4}} < r_{3} \leq {r_{4} + Q}} \\ {R_{3} < R_{4}} & {{{{if}\ r_{4}} + Q} < r_{3}} \\ {R_{3} < R_{4}} & {{{if}\ r_{3}} < r_{4} \leq {r_{3} + Q}} \\ {R_{3} > R_{4}} & {{{{if}\ r_{3}} + Q} < r_{4}} \\ {R_{3} = R_{4}} & {{{if}\ r_{3}} = r_{4}} \end{matrix} \right.$

And F_(E) decides on max{A(i,j), B(i,j), R₅}, based on {res(A(i,j),

), res(B(i,j),

), r₅} and the conditions of Lemma 10.

The followings describe a first example. For the substitution score map κ, some embodiments may use Blosum50, one of the Blocks Substitution Matrices. In bioinformatics, the Blocks Substitution Matrices, (Blosum), may be used in sequence alignment of proteins. Blosum matrices are used to score alignments between evolutionarily divergent protein sequences.

Using Blosum50, the values of κ_(max)=15, and κ_(min)=−5 may be found. Further details may be found at “Selecting the Right Similarity-Scoring Matrix”, by William R. Pearson, first published: 16 Feb. 2018.

Further, let's use α=10, and β=1.

Then, from Lemma 7.1: LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β}=min{−85,−41}=−85 UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)}=max{85,10}=85

Therefore, Q=max{abs(LB), UB}}=85.

Thus, the modulus

may be picked to be

=2Q+1=171. Therefore, each r₁-r₅ may be represented and stored with 8 bits while each Q1-Q5 would require a longer register to be stored. Therefore, the memory requirement of the global alignment with affine gap score is reduced using the present invention.

FIG. 4A illustrates five 8-bit registers, according to various aspects of the present disclosure. FIG. 4B illustrates a 64-bit registers with two 8-bit accessible 8-bit segments, according to various aspects of the present disclosure. FIG. 4C illustrates storing data in the accessible portion of registers, according to various aspects of the present disclosure.

With reference to FIG. 4A, five registers 301-305 are shown. Each of the register 301-305 has 8 bits memory. The residue values r₁-r₅ are stored in the registers 301-305, respectively. With reference to FIGS. 4B and 4C, a second efficient method to storing the residues are explained.

FIG. 4B shows a register 310 that has 64 bits memory in eight bytes segments 311-318. Only the segments 317 and 318 are directly accessible to the software, and the rest are not directly accessible as bytes. FIG. 4C shows the register 310 and two other register 320 and 330 that have the same architecture as the register 310. Next, the residues may be stored in the accessible segments of the registers 310, 320, and 330.

The followings are examples of the values that may be stored in the registers 310, 320, and 330. The residue r₁ in the segment 317 of the register 310. The residue r₂ in the segment 318 of the register 310. The residue r₃ in the segment 327 of the register 320. The residue r₄ in the segment 328 of the register 320. The residue r₅ in the segment 328 of the register 330.

Another method to lessen the register memory requirement is to use segments of registers that are not directly accessible, and recover the residues by masking and/or bit shifting. However, frequently it is faster (requires less clock cycles) to executed directly accessible memory than memory through masking and/or bit shifting.

The followings describe how the key recursion equations are processed according to the various aspects of the present disclosure. FIG. 5A illustrates the key recursion unit for the global alignment, according to the traditional approaches. With reference to FIG. 5A, a key recursion unit 400 is shown according to the traditional approaches. The key recursion unit 400 receives the following input: A(i,j−1), E(i,j−1), B(i−1,j), E(i−1,j), and E(i−1,j−1). And it generates the following output: A(i,j), B(i,j), E(i,j), I_(A(i,j)), I_(B(i,j)), and I_(E(i,j)).

The key recursion unit 400 performs the following calculations of the key recursion equations:

${A\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {i,{j - 1}} \right)} + v} \\ {{A\left( {i,{j - 1}} \right)} + v_{v}} \end{matrix} \right.}$ ${B\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {{i - 1},j} \right)} + h} \\ {{B\left( {{i - 1},j} \right)} + h_{h}} \end{matrix} \right.}$ ${E\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {{i - 1},{j - 1}} \right)} + {\kappa\left( {x_{i},y_{j}} \right)}} \\ {A\left( {i,j} \right)} \\ {B\left( {i,j} \right)} \end{matrix} \right.}$

FIG. 5B illustrates the key recursion unit 410 for the global alignment, based on residues, according to various aspects of the present disclosure. The key recursion unit 410 receives the following input: res(A(i,j−1),

), res(B(i−1,j),

), res(E(i,j−1),

), res(E(i−1,j),

), and res(E(i−1,j−1),

). The key recursion unit 410 of the present embodiments generates the following results: res(A(i,j),

), res(B(i,j),

), res(E(i,j),

), I_(A(i,j)), I_(B(i,j)), and I_(E(i,j)). Thus, the first embodiment computes the traceback variables based on the residues instead of the dividends.

FIG. 6 illustrates a hardware and software block diagram of the first embodiment, according to various aspects of the present disclosure. With reference to FIG. 6 , different blocks performing the key recursion unit 410 are shown. The operations may be explained in the following three parts.

In Part 1, res(A(i,j),

) and I_(A(i,j)) may be found. In order to compute res(A(i,j),

), the key recursion unit 410 performs an add/compare/select using two mod

adders 415 and 425, a compare unit (e.g., a combinational logic comparator) 420, and a select unit (e.g., a multiplexer) 450. The mod

adder 415 receives two inputs: res(A(i,j−1),

) and v_(v) (note v_(v)=−β), and computes their sum modulo

. The mod

adder 415 outputs r₁, which is res(A(i,j−1)+v_(v),

). The mod

adder 425 receives two inputs: res(E(i,j−1),

) and v (note v=−β−α), and computes their sum modulo

. The mod

adder 425 outputs r₂, which is res(E(i,j−1)+v,

).

The task of the compare unit 420 is to decide whether R₂=E(i,j−1)+v is less than, equal or greater than R₁=A(i,j−1)+v_(v). The compare unit 420 performs its task based on r₁, r₂ and Lemma 10, where r₁=R₁ mod

and r₂=R₂ mod

. Specifically,

$\left\{ \begin{matrix} {R_{1} > R_{2}} & {{{if}\ r_{2}} < r_{1} \leq {r_{2} + Q}} \\ {R_{1} < R_{2}} & {{{{if}\ r_{2}} + Q} < r_{1}} \\ {R_{1} < R_{2}} & {{{if}\ r_{1}} < r_{2} \leq {r_{1} + Q}} \\ {R_{1} > R_{2}} & {{{{if}\ r_{1}} + Q} < r_{2}} \\ {R_{1} = R_{2}} & {{{if}\ r_{1}} = r_{2}} \end{matrix} \right.$

The compare unit 420 outputs a signal Control₁. Control₁ is ‘2’ if R₁≥R₂, and is ‘1’ otherwise. Thus, the compare unit 420 breaks ties toward R₁'s favor. The select unit 450 receives the values: r₁, r₂, and Control₁. The select unit 450 outputs res(A(i,j),

)=r₁ if the Control₁ value is ‘2’, and outputs res(A(i,j),

)=r₂ if the Control₁ value is ‘1’. Therefore, the select unit 450 outputs not A(i,j) but res(A(i,j),

). Further, I_(A(i,j))=Control₁.

In Part 2, res(B(i,j),

) and I_(B(i,j)) may be found. In order compute res(B(i,j),

), the key recursion unit 410 performs an add/compare/select using two mod

adders 430 and 440, a compare unit 435, and a select unit 455. The mod

adder 430 receives two inputs: res(B(i−1,j),

) and v_(v) (note v_(v)=−β), and computes their sum modulo

. The mod

adder 430 outputs r₃, which is res(B(i−1,j)+v_(v),

). The mod

adder 440 receives two inputs: res(E(i−1,j),

) and v (note v=−β−α), and computes their sum modulo

.

The mod

adder 440 outputs r₄, which is res(E(i−1,j)+v,

). The task of the compare unit 435 is to decide whether R₃=E(i−1,j)+v is less than, equal or greater than R₄=B(i−1,j)+v_(v). The compare unit 435 performs its task based on r₃, r₄ and Lemma 10, where r₃=R₃ mod

and r₄=R₄ mod

. Specifically,

$\left\{ \begin{matrix} {R_{3} > R_{4}} & {{{if}\ r_{4}} < r_{3} \leq {r_{4} + Q}} \\ {R_{3} < R_{4}} & {{{{if}\ r_{4}} + Q} < r_{3}} \\ {R_{3} < R_{4}} & {{{if}\ r_{3}} < r_{4} \leq {r_{3} + Q}} \\ {R_{3} > R_{4}} & {{{{if}\ r_{3}} + Q} < r_{4}} \\ {R_{3} = R_{4}} & {{{if}\ r_{3}} = r_{4}} \end{matrix} \right.$

The compare unit 435 outputs a signal Control₂. Control₂ is ‘2’ if R₃≥R₄, and is ‘1’ otherwise. Thus, the compare unit 435 breaks ties toward R₃'s favor. The select unit 455 receives the values: r₃, r₄, and Control₂. The select unit 455 outputs res(B(i,j),

)=r₃ if the Control₂ value is ‘2’, and outputs res(A(i,j),

)=r₄ if the Control₂ value is ‘1’. Therefore, the select unit 455 outputs not B(i,j) but res(B(i,j),

). Further, I_(B(i,j))=Control₂.

In Part 3, res(E(i,j),

) and I_(E(i,j)) may be found. In order compute res(E(i,j),

), the key recursion unit 410 performs an add/compare/select using a mod

adders 445, a 3 way compare unit 460, and a select unit 465. The mod

adder 445 receives two inputs: res(E(i−1,j−1),

) and x(x_(i),y_(j)), and computes their sum modulo

. The mod

adder 445 outputs r₅, which is res(E(i−1,j−1)+κ(x_(i),y_(j)),

).

The task of the compare unit 460 is to decide a maximal value among: A(i,j), B(i,j), and R₅=E(i−1,j−1)+κ(x_(i),y_(j)). The compare unit 460 performs its task based on res(A(i,j),

), res(B(i,j),

), and r₅, using Lemma 10. One way to compute a maximal value of a set of values is to compare two values at a time using Lemma 10, and keeping the/a larger one.

The compare unit 460 outputs a signal Control₃ shown below.

${Control}_{3} = \left\{ \begin{matrix} {\,^{\prime}2^{\prime}} & {{{if}\ {A\left( {i,j} \right)}} \geq {{B\left( {i,j} \right)}\ {and}\ {A\left( {i,j} \right)}} \geq R_{5}} \\ {\,^{\prime}3^{\prime}} & {{{if}\ {B\left( {i,j} \right)}} > {{A\left( {i,j} \right)}\ {and}\ {B\left( {i,j} \right)}} \geq R_{5}} \\ {\,^{\prime}1^{\prime}} & {{{if}\ R_{5}} > {{A\left( {i,j} \right)}\ {and}\ R_{5}} > {B\left( {i,j} \right)}} \end{matrix} \right.$

The select unit 465 outputs res(E(i,j),

=) res(A(i,j),

) if the Control₃ value is ‘2’, outputs res(E(i,j),

)=res(B(i,j),

) if the Control₃ value is ‘3’, and outputs res(E(i,j),

)=r₅ if the Control₃ value is ‘1’. Therefore, the select unit 465 outputs not E(i,j) but r_(E)(i,j), where r_(E)(i,j)=E(i,j)mod

. Further, I_(E(i,j))=Control₃.

Thus, used recursively, the key recursion equations processed according to the present invention produce the same decisions based on residues as when processed according to the traditional methods. Using the residues lessens the requirement on memory.

Using less registers or using shorter registers leads to using less electric power (watts). Less electric power used leads to less heat generated in hardware, which enables faster speed.

The followings describe a second example. In this example, scores for DNA segments alignment are picked. Let match score=κ_(max)=1, mis-match score=κ_(min)=−5, and opening gap score=α+β=5.

Then, from Lemma 7.1: LB=min{−2κ_(max)−5(α+β),−κ_(max)−2α−β+κ_(min)}=min{−27,−16}=−27 UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)}=max{27,6}=27, and

Q=max{abs(LB), UB}}=27. Thus, the modulus

may be picked to be

=2*Q+1=55.

Therefore, each r₁-r₅ may be represented and stored with 6 bits. Therefore, the present disclosure according to the first embodiment reduces the storage requirement by performing the key recursion equations based on residues of values modulo a suitable modulus

.

Traceback may be done the traditional way by using the variables: I_(A)'s, I_(B)'s, and I_(E)'s.

One way to compute the score of final alignment, E(n,m), is to generate a best alignment based on the backtrack variables, then use the score functions to evaluate the alignment score. It should be noted that the backtrack or traceback variables may be arranges in a matrix with (i,j) coordinates.

Another way is to evaluate it during the backtrack stage. Since the memory of the score map is limited to two for gaps, it is needed to traceback two steps to resolve the score when a gap is reached during the backtrack, except when the vertex (0,0) is reached.

3. The Second Embodiment—The Modular Based Dynamical Program Using a Software and/or Firmware Running on a Specialized Computer, for Global Alignment

In the second embodiment of modulo based, genetic material alignment methods, the global alignment is implemented using a software running on a CPU, with accelerating features in software or hardware. Examples of a software language include python, C, Assembly, etc.

Accelerating hardware features are described with reference to FIG. 7 . FIG. 7 illustrates a CPU architecture with an accelerating unit, according to various aspects of the present disclosure. With reference to FIG., the CPU 500 may be connected to a main memory 510, an input 520 and an input 530. The CPU 500 has an accelerating unit 540.

The accelerating unit 540 may have at least one of the following technologies:

-   -   1) Multithreading     -   2) Multi-Arithmetic Logic Unit (ALU)     -   3) Vector processor     -   4) Multi-core     -   5) Parallel processing     -   6) Multiple Instruction, Single Data (MISD)     -   7) Single Instruction, Multiple Data (SIMD)     -   8) Multiple Instruction, Multiple Data (MIMD)

These accelerating features may allow the CPU 500 to speed up the alignment. For example, the CPU 500 may be enabled by the accelerating unit 540 to operate the mod

adders 415, 425, 430, 440, and 445 simultaneously (FIG. 6 ). The CPU 500 may be enabled by the accelerating unit 540 to operate the computation of the res(A(i,j),

) and the computation of the res(B(i,j),

) simultaneously, (FIG. 6 ). The CPU 500 may be enabled by the accelerating unit 540 to operate the computation of res(E(i,j),

) and the computation of the r_(E)(i′,j′) simultaneously, (FIG. 5B), as long as res(A(i,j−1),

), res(B(i−1,j),

), res(E(i,j−1),

), res(E(i−1,j),

), res(E(i−1,j−1),

), res(A(i′,j′−1),

), res(B(i′−1,j′),

), res(E(i′,j′−1),

), res(E(i′−1,j′),

), and res(E(i′−1,j′−1),

) are available.

The followings are the features of the accelerating software. The main memory 510 may have a software accelerating unit 515. One feature in the software accelerating unit 515 is parallelized architecture. A parallelized architecture in the software accelerating unit 515 is processing of the global alignment for vertices that are on a same diagonal (from upper right to lower left). FIG. 8 illustrates the diagonal vertices used in parallel processing, according to various aspects of the present disclosure. With reference to FIG. 8 , an alignment digraph 600 is shown. Vertices of the alignment digraph 600 that are on a same diagonal are connected with a dash-dotted line.

No two vertex of the alignment digraph 600 that are on a same diagonal are connected. Therefore, the key recursion equations of the vertices that are on a same diagonal are computed in parallel based on values for the left two diagonals. The CPU 500 may take advantage of the parallelized architecture by the accelerating unit 540 to speed up the alignment. More specifically, the CPU 500 processes the key recursion equations of vertices on a diagonal in parallel.

4. The Third Embodiment—The Modular Based Dynamical Program Using a Customized Hardware, for Global Alignment

The third embodiment of modulo based, genetic material alignment methods is a hardware implementation for computing the key recursion equations with residues. There are 3 main equations in the key recursion equations in global alignment. Each equation requires finding a maximal element of a set.

1) A(i,j) equals a maximal element of a set Set_(A(i,j))={E(i,j−1)+v, A(i,j−1)+v_(v)}

2) B(i,j) equals a maximal element of Set_(B(i,j))={E(i−1,j)+h, B(i−1,j)+h_(h)}

3) E(i,j) equals a maximal element of Set_(E(i,j))={E(i−1,j−1)+κ(x_(i),y_(j)), A(i,j), B(i,j)}

For global alignment, the third embodiment of the present disclosure gives a hardware implementation of the following 3 functions, F_(A), F_(B), and F_(E) for generating [res(A(i,j),

),I _(A(i,j)) ]=F _(A)(res(A(i,j−1),

),res(E(i,j−1),

))) [res(B(i,j),

),I _(B(i,j)) ]=F _(A)(res(B(i−1,j),

),res(E(i−1,j),

))) [res(E(i,j),

),I _(E(i,j)) ]=F _(E)(res(E(i−1,j−1),

),res(A(i,j),

),res(B(i,j),

)).

Now F_(A) decides on max {R₁, R₂}, based on {r₁, r₂} using the conditions of Lemma 10.

Conditions of the Lemma 10:

$\left\{ \begin{matrix} {R_{1} > R_{2}} & {{{if}r_{2}} < r_{1} \leq {r_{2} + Q}} \\ {R_{1} < R_{2}} & {{{{if}r_{2}} + Q} < r_{1}} \\ {R_{1} < R_{2}} & {{{if}r_{1}} < r_{2} \leq {r_{1} + Q}} \\ {R_{1} > R_{2}} & {{{{if}r_{1}} + Q} < r_{2}} \\ {R_{1} = R_{2}} & {{{if}r_{1}} = r_{2}} \end{matrix} \right.$

And F_(B) decides on max {R₃, R₄}, based on {r₃, r₄} using the conditions of Lemma 10.

Conditions of the Lemma 10:

$\left\{ \begin{matrix} {R_{3} > R_{4}} & {{{if}r_{4}} < r_{3} \leq {r_{4} + Q}} \\ {R_{3} < R_{4}} & {{{{if}r_{4}} + Q} < r_{3}} \\ {R_{3} < R_{4}} & {{{if}r_{3}} < r_{4} \leq {r_{3} + Q}} \\ {R_{3} > R_{4}} & {{{{if}r_{3}} + Q} < r_{4}} \\ {R_{3} = R_{4}} & {{{if}r_{3}} = r_{4}} \end{matrix} \right.$

And F_(E) decides on max{A(i,j), B(i,j), R₅}, based on {res(A(i,j),

), res(B(i,j),

), r₅} and the conditions of Lemma 10.

In some of the present embodiments, the conditions of the Lemma 10 are first applied to residues: res(A(i,j),

), res(B(i,j),

) to find the larger of the {A(i,j), B(i,j)}. If A(i,j)≥B(i,j) (A is biased arbitrarily), then the conditions of the Lemma 10 are applied to: res(A(i,j),

) and r₅ to find an overall largest among {A(i,j), B(i,j), R₅}. But if A(i,j)<B(i,j), then the conditions of the Lemma 10 are applied to: res(B(i,j),

) and r₅ to find an overall largest.

The third embodiment gives a hardware implementation of the above process. The residues may be represented in 2's complement, and the example 2 parameters for DNA segment alignment may be used. Thus, match score=κ_(max)=1, mis-match score=κ_(min)=−5, opening gap score=α+β=5.

Then, from Lemma 7.1: Q=27 (see above). Thus, the modulus

may be picked to be

≥2*Q+1=55.

may be chosen to be

=64=2⁶, to ease the hardware architecture. Therefore, there may be 7 bits 2's complement representation to handle mod 2⁶. In 7 bits 2's complement, a binary vector (x₆, x₅, x₄, x₃, x₂, x₁, x₀) represent the integer x as follows: x=x₆(−2⁶)+x₅2⁵+x₄2⁴+x₃2³+x₂2²+x₁2¹+x₀2⁰.

The 2's complement representation of x may be denoted by t_(x). Let's use t_(res(A(i,j−1),)

₎, t_(res(B(i−1,j),)

₎, t_(res(E(i,j−1),)

₎, t_(res(E(i−1,j),)

₎, and t_(res(E(i−1,j−1)) to denote the 7 bits 2's complement representations of res(A(i,j−1),

), res(B(i−1,j),

), res(E(i,j−1),

), res(E(i−1,j),

), and res(E(i−1,j−1), respectively.

Also let t_(b), t_(a), and t_(c) to denote the 7 bits 2's complement representation of −β mod

, −α−β mod

, and κ(x_(i),y_(j))mod

, respectively. FIG. 9 illustrates the F_(A) hardware of the third embodiment, according to various aspects of the present disclosure. With reference to FIG. 9 , an F_(A) hardware 601 may be described. The F_(A) hardware 601 may comprise three 7-bit adders 602, 603, and 604, and a multiplexer 605. The inputs to the adder 602 may be t_(res(A(i,j−1),)

₎(6:0) and t_(b)(6:0).

A carry signal to the adder 602 may be ‘0’. The output of the adder 602 may be t₁(6:0), where t_(r) ₁ =(0 t₁(5:0)). The inputs to the adder 603 may be: t_(res(E(i,j−1),)

₎6:0) and t_(a)(6:0).

A carry signal to the adder 603 may be ‘0’. The output of the adder 603 may be t₂(6:0), where t_(r) ₂ =(0 t₂(5:0)). The inputs to the adder 604 may be: t_(r) ₂ (6:0) and t_(r) ₁ (6:0), (x denoted the complement of x). The output of the adder 603, (0 t₂(5:0)), may be complemented by a not gate 606 before entering the adder 604.

A carry signal to the adder 604 may be ‘1’. In this shape, the adder 604 may function as a 2's complement subtractor. It generates, t₁₋₂(6:0), which is t_(r) ₁ -t_(r) ₂ in 2's complement. The adder 604 outputs t₁₋₂(6:5), which is bits at locations 5 and 6 in t₁₋₂(6:0) and a zero flag, which is ‘0’ unless t₁₋₂(6:0)=(0,0,0,0,0,0,0).

The main function of the adder 604 is to generate I_(A).

Recall: I _(A)=2, if R ₁ >R ₂ I _(A)=1, if R ₁ <R ₂ I _(A)=2, if R ₁ =R ₂

The adder 604 generates I_(A), based on r₁ and r₂, using the conditions of the Lemma 10.

$\left\{ \begin{matrix} {R_{1} > R_{2}} & {{{if}r_{2}} < r_{1} \leq {r_{2} + Q}} \\ {R_{1} < R_{2}} & {{{{if}r_{2}} + Q} < r_{1}} \\ {R_{1} < R_{2}} & {{{if}r_{1}} < r_{2} \leq {r_{1} + Q}} \\ {R_{1} > R_{2}} & {{{{if}r_{1}} + Q} < r_{2}} \\ {R_{1} = R_{2}} & {{{if}r_{1}} = r_{2}} \end{matrix} \right.$

In terms of t₁₋₂: R ₁ >R ₂ if t ₁₋₂(6)=0 and t ₁₋₂(5)=0 and zero flag=‘0’ R ₁ <R ₂ if t ₁₋₂(6)=0 and t ₁₋₂(5)=1 R ₁ <R ₂ if t ₁₋₂(6)=1 and t ₁₋₂(5)=1 R ₁ >R ₂ if t ₁₋₂(6)=1 and t ₁₋₂(5)=0 R ₁ =R ₂ zero flag=‘1’ Therefore, I _(A)=2 if(t ₁₋₂(6:5)=(0,0) and zero flag=‘0’) OR t ₁₋₂(6:5)=(1,0) I _(A)=1 if t ₁₋₂(6:5)=(0,1) OR t ₁₋₂(6:5)=(1,1) I _(A)=2 if zero flag=‘1’

The multiplexer 605 receives values, t_(r) ₁ =(0 t₁(5:0)) and t_(r) ₂ =(0 t₂(5:0)), and it outputs t_(r) ₁ unless t₁₋₂(5)=1, in which case it outputs t_(r) ₂ . This makes the output of the multiplexer 605 to be

(6:0). Therefore, only t₁₋₂(5) is sufficient to control the multiplexer. The multiplexer 605 and the F_(A) hardware 601 may be made arbitrarily biased toward t_(r) ₁ , that is when t_(r) ₁ =t_(r) ₂ , it breaks the tie in favor of t_(r) ₁ .

FIG. 10 illustrates the FB hardware of the third embodiment, according to various aspects of the present disclosure. With reference to FIG. 10 , an F_(B) hardware 611 may be described. The F_(B) hardware 611 may comprise three 7-bit adders 612, 613, and 614, and a multiplexer 615. The inputs to the adder 612 may be

(6:0) and t_(b)(6:0). A carry signal to the adder 612 may be ‘0’.

The output of the adder 612 may be t₃(6:0), where t_(r) ₃ =(0 t₃ (5:0)). The inputs to the adder 613 may be

6:0) and t_(a)(6:0). A carry signal to the adder 613 may be ‘0’. The output of the adder 613 may be t₄(6:0), where t_(r) ₄ =(0 t₄(5:0)).

The inputs to the adder 614 may be t_(r) ₄ (6:0) and t_(r) ₃ (6:0). The output of the adder 613, (0 t₄(5:0)), may be complemented by a not gate 616 before entering the adder 614. A carry signal to the adder 614 may be ‘1’. In this shape, the adder 614 may functions as a 2's complement subtractor. It generates, t₃₋₄(6:0), which is t_(r) ₃ -t_(r) ₄ in 2's complement. The adder 614 outputs t₃₋₄(6:5), which is bits at locations 5 and 6 in t₃₋₄(6:0) and a zero flag, which is ‘0’ unless t₃₋₄(6:0)=(0,0,0,0,0,0,0). The main function of the adder 614 may be to generate I_(B).

Recall: I _(B)=2, if R ₃ >R ₄ I _(B)=1, if R ₃ <R ₄ I _(B)=2, if R ₃ =R ₄

The adder 614 generates I_(A), based on r₁ and r₂, using the conditions of the Lemma 10.

$\left\{ \begin{matrix} {R_{3} > R_{4}} & {{{if}r_{4}} < r_{3} \leq {r_{4} + Q}} \\ {R_{3} < R_{4}} & {{{{if}r_{4}} + Q} < r_{3}} \\ {R_{3} < R_{4}} & {{{if}r_{3}} < r_{4} \leq {r_{3} + Q}} \\ {R_{3} > R_{4}} & {{{{if}r_{3}} + Q} < r_{4}} \\ {R_{3} = R_{4}} & {{{if}r_{3}} = r_{4}} \end{matrix} \right.$

In terms of t₃₋₄: R ₃ >R ₄ if t ₃₋₄(6)=0 and t ₃₋₄(5)=0 and zero flag=‘0’ R ₃ <R ₄ if t ₃₋₄(6)=0 and t ₃₋₄(5)=1 R ₃ <R ₄ if t ₃₋₄(6)=1 and t ₃₋₄(5)=1 R ₃ >R ₄ if t ₃₋₄(6)=1 and t ₃₋₄(5)=0 R ₃ =R ₄ zero flag=‘1’ Therefore, I _(B)=2 if(t ₃₋₄(6:5)=(0,0) and zero flag=‘0’) OR t ₃₋₄(6:5)=(1,0) I _(B)=1 if t ₃₋₄(6:5)=(0,1) OR t ₃₋₄(6:5)=(1,1) I _(B)=2 if zero flag=‘1’

The multiplexer 615 receives values, t_(r) ₃ =(0 t₃(5:0)) and t_(r) ₄ =(0 t₄(5:0)), and it outputs t_(r) ₃ unless t₃₋₄(5)=1, in which case it outputs t_(r) ₄ . This makes the output of the multiplexer 615 to be

(6:0). Therefore, only t₃₋₄(5) is sufficient to control the multiplexer. The multiplexer 615 and the F_(B) hardware 611 may be made arbitrarily biased toward t_(r) ₃ , that is when t_(r) ₃ =t_(r) ₄ , it breaks the tie in favor of t_(r) ₃ .

FIGS. 11A and 11B illustrate the FE hardware of the third embodiment, according to various aspects of the present disclosure. An F_(E) hardware 621 is described with reference to FIG. 11A. The F_(E) hardware 621 may comprise a 7-bit adder 623, a 3 way compare 624, and a multiplexer 625.

The inputs to the adder 623 may be

(6:0) and t_(c)(6:0). A carry signal to the adder 623 may be ‘0’. The output of the adder 623 may be t₅(6:0), where t_(r) ₅ =(0 t₅(5:0)). The compare 624 may have 3 inputs:

,

, and t_(r) ₅ =(0 t₅(5:0)). The compare 624 may find I_(E). It is arbitrarily biased first toward A, next toward B, as follows: I _(E)=2 if A(i,j)≥B(i,j) and A(i,j)≥R ₅ I _(E)=3 if A(i,j)<B(i,j) and B(i,j)≥R ₅ I _(E)=1 if A(i,j)<R ₅ and B(i,j)<R ₅

The compare 624 may output out=I_(E).

One way the compare 624 finds I_(E) is by first comparing A(i,j) and B(i,j) using Lemma 10, second comparing R₅ with the winner of A(i,j) and B(i,j) using Lemma 10. Here there may be two compares of the type performed by the adder 604 and adder 614, in series.

Another way is by first making 3 compares in parallel:

-   -   1) A(i,j) and B(i,j)     -   2) A(i,j) and R₅     -   3) B(i,j) and R₅

Second, find I_(E) based on the 3 parallel compares.

FIG. 11B shows an implementation of the compare 624 based on the parallel compare method. The compare 624 has 3 adders 632 and 633. The inputs to the adder 631 are:

(6:0) and

(6:0). A not gate 641 may complement

(6:0) to generate

(6:0). A carry signal to the adder 631 may be ‘1’.

The adder 631 may produce t′=

(6:0). Based on Lemma 10, (i,j)≥B(i,j) if t′(5)=0, and A(i,j)<B(i,j) if t′(5)=1, as was described above.

The inputs to the adder 632 may be t_(r) ₅ (6:0) and

(6:0). A not gate 642 may complement t_(r) ₅ (6:0) to generate t_(r) ₅ (6:0). A carry signal to the adder 632 may be ‘1’. The adder 632 may produces t″=

(6:0).

Based on Lemma 10, B(i,j)≥R₅ if t″(5)=0, and B(i,j)<R₅ if t″(5)=1. The inputs to the adder 633 may be t_(r) ₅ (6:0) and

(6:0). A not gate 642 may complement t_(r) ₅ (6:0) to generate t_(r) ₅ (6:0). A carry signal to the adder 633 may be ‘1’. The adder 633 may produce t′″=

(6:0).

Based on Lemma 10, A(i,j)≥R₅ if t′″(5)=0, and A(i,j)<R₅ if t′″(5)=1. With further reference to FIG. 11B, the compare 624 may further have a logic circuit 650. The logic circuit 650 may function according to Table 4.

TABLE 4 t′(5) t″(5) t′″(5) largest ‘k’ = (t′(5) t″(5) AND t′″(5)) 0 0 0 A (0, 0) => k = 2 A >= B B >= C A >= C 0 0 1 NA A >= B B >= C A < C 0 1 0 A (0, 0) => k = 2 A >= B B < C A >= C 0 1 1 C (0, 1) => k = 1 A >= B B < C A < C 1 0 0 B (1 0) => k = 3 A < B B >= C A >= C 1 0 1 B (1 0) => k = 3 A < B B >= C A < C 1 1 0 NA A < B B < C A >= C 1 1 1 C (1, 1) => k = 1 A < B B < C A < C

The output of the compare 624 is out (2 bits)=‘k’=(t′(2) (t″(2) AND t′″(2))). The multiplexer 625 may receive values,

(6:0),

(6:0), and t_(r) ₅ (6:0), and it outputs may be

(6:0) if out ‘2’,

(6:0) if out=‘3’, and t_(r) ₅ (6:0), if out=‘1’. This makes the output of the multiplexer 625 to be

.

By optimizing the 7-bit operations of the customized hardware of FIGS. 9, 10, 11A and 11B for speed, the dynamic program of the alignment may be sped up.

5. The Fourth Embodiment—The Modular Based Dynamical Program Using a Customized Hardware in a Parallel Processing Setting for Global Alignment

The fourth embodiment of modulo based, genetic material alignment methods is a hardware implementation of the key recursion equations with residues, in a parallel processing setting. Referring to the alignment digraph 600 in FIG. 8 , the vertices are labeled (i,j), where i points to a column and j points to a row. The labels, (i,j), of vertices on a same diagonal have the same sum, i+j. In the fourth embodiment, vertices of a same diagonal are processes in parallel. Let's label a diagonal by the sum of the coordinates of the vertices on the diagonal. For example, diagonal 0 has only one vertex, (0,0), the diagonal 1 has two vertices: (0,1) and (1,0), so on.

The processing starts with diagonal 2; diagonals 0 and 1 are initialized. Each column, i, may have a specialized hardware of its own, H_(i). FIG. 12 illustrates parallel processing in the fourth embodiment, according to various aspects of the present disclosure. With reference to FIG. 12 , a specialized hardware H_(i−1) 700 for column i−1 and a specialized hardware H_(i) 800 for column i are shown. The hardware H_(i−1) 700 may have the F_(A) hardware 601, the F_(B) hardware 611, and the F_(E) hardware 621. In addition, the hardware H_(i−1) 700 may have 7 registers Reg0 _(A) 701, Reg1 _(A) 702, Reg0 _(B) 711, Reg1 _(B) 712, Reg0 _(E) 721, Reg1 _(E) 722, and Reg2 _(E) 723.

The hardware H_(i) 800 may have the F_(A) hardware 601, the F_(B) hardware 611, and the F_(E) hardware 621. The hardware H_(i) 800 may have 7 registers: Reg0 _(A) 801, Reg1 _(A) 802, Reg0 _(B) 811, Reg1 _(B) 812, Reg0 _(E) 821, Reg1 _(E) 822, and Reg2 _(E) 823. Connectivity in H_(i) 800 and between H_(i) 800 and H_(i−1) 700 are explained below.

At the start of processing vertices on diagonal k, the register values are:

Reg0 _(A) 701 value all 0's

Reg1 _(A) 702 value is t_(res(A(i−1,j),M))

Reg0 _(B) 711 value all 0's

Reg1 _(B) 712 value is t_(res(B(i−1,j),M))

Reg0 _(E) 721 value all 0's

Reg1 _(E) 722 value is t_(res(E(i−1,j),M))

Reg2 _(E) 723 value is t_(res(E(i−1,j−1),M))

Reg0 _(A) 801 value all 0's

Reg1 _(A) 802 value is t_(res(A(i,j−1),M))

Reg0 _(B) 811 value all 0's

Reg1 _(B) 812 value is t_(res(B(i,j−1),M))

Reg0 _(E) 821 value all 0's

Reg1 _(E) 822 value is t_(res(E(i,j−1),M))

Reg2 _(E) 823 value is t_(res(E(i,j−2),M))

Now, the hardware H_(i−1) 700 will process the vertex (i−1,k−i+1), and the hardware H_(i) 800 will process the vertex (i,k−i).

The process is explained in the following 3 steps. In Step 1, the F_(A) hardware 601 of the hardware H_(i) 800 receives the values t_(res(A(i,j−1),M)) and t_(res(E(i,j−1),M)) from the registers Reg1 _(A) 802 and Reg1 _(E) 822, respectively. It will output t_(res(A(i,j),M)), which will be sent to both the F_(E) hardware 621 of the hardware H_(i) 800 and the register Reg0 _(A) 801. For every column, t, t≠i, the F_(A) hardware H_(t) is processed in a similar manner, during step 1. Index variables, I_(A), are stored.

The F_(B) hardware 601 of the hardware H_(i) 800 receives the values t_(res(B(i−1,j),M)) and t_(res(E(i−1,j),M)) from the registers Reg1 _(B) 712 and Reg1 _(E) 722, respectively. It will output t_(res(B(i,j),M)), which will be sent to both the F_(E) hardware 621 of the hardware H_(i) 800 and the register Reg0 _(B) 811. For every column, t, t≠i, the F_(B) hardware H_(t) is processed in a similar manner, during step 1. Index variables, I_(B), are stored.

In Step 2, the F_(E) hardware 621 of the hardware H_(i) 800 receives the value t_(res(E(i−1,j−1),M)) from the register Reg2 _(E) 723 of the hardware H_(i−1) 700. And it generates value t_(res(E(i,j),M)) based on t_(res(A(i,j),M)), t_(res(B(i,j),M)), and t_(res(E(i−1,j−1),M)). Now, the F_(E) hardware 621 of the hardware H_(i) 800 sends t_(res(E(i,j),M)) to the register Reg0 _(E) 821. For every column, t, t≠i, the F_(E) hardware H_(t) is processed in a similar manner, during step 2. Index variables, I_(E), are stored.

In Step 3, the register Reg0 _(A) 801 may be shifted into the register Reg1 _(A) 802, the register Reg0 _(B) 811 may be shifted into the register Reg1 _(B) 812, the register Reg1 _(E) 822 may be shifted into the register Reg2 _(E) 823, and the register Reg0 _(E) 821 may be shifted into the register Reg1 _(E) 822. For every column, t, t≠i, the registers of hardware H_(t) is processed in a similar manner, during step 3. A rendering of the fourth embodiment is as follows. Instead of assigning columns distinct H hardware, the columns may be partitioned into intervals. Then the first interval may be processed as in the fourth embodiment, at the same time the values for the boundary condition may be collected. Next, the second interval may be processed as in the fourth embodiment using the collect boundary values. This rendering needs fewer hardware H's, but it requires extra register to store the boundary conditions of B's and E's.

G. Overlapping Alignment

The fifth embodiment of modulo based, genetic material alignment methods is a hardware implementation for computing the key recursion equations with residues for an overlapping alignment with affine gap score.

1. The Goal of the Overlapping Alignment

Given two sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m), the x and y alignment digraph D(x,y) with vertex set

, and the score maps {circumflex over (φ)}₀ and {circumflex over (φ)}₁, the goal of the overlapping alignment is to find a walk, W^(max), starting from a vertex on the top row or leftmost column and end on a vertex on the bottom row or the rightmost column on the alignment digraph D(x,y), such that W^(max)=((i₀,j₀), (i₁,j₁), . . . , (i_(k),j_(k))), where i₀=0 or j₀=0, and where i_(k)=0 or j_(k)=0, having a maximal score. The score functions {circumflex over (φ)}₀ and {circumflex over (φ)}₁ are as defined above. Further, an affine gap score with values in Table 3 may be assumed.

The global alignment may be modified with affine score to perform the overlapping alignment with affine gap score. The main modification is simple, and it requires a change in the update rules for i=0, and j=0 cases. These cases are often considered as part of the initialization since they address i=0, and j=0.

For the overlapping alignment with affine gap score:

D(i,j) is the best score over all walks from (0,0) to (i,j). If no such walk exists, then D(i,j)=−Inf.

A(i,j) is the best score over all walks from (0,0) to (i,j) that end with a vertical arc. If no such walk exists, then A(i,j)=−Inf.

B(i,j) is the best score over all walks from (0,0) to (i,j) that end with a horizontal arc. If no such walk exists, then B(i,j)=−Inf.

Initialization: E(0,0)=0 E(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0 A(0,0)=−Inf A(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0 B(0,0)=−Inf B(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0

Update Rules:

(i, j) ≠ (0, 0) ${E\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {{i - 1},{j - 1}} \right)} + {\kappa\left( {x_{i},y_{j}} \right)}} \\ {A\left( {i,j} \right)} \\ {B\left( {i,j} \right)} \end{matrix} \right.}$ ${A\left( {i,j} \right)} = {\max\left\{ {{\begin{matrix} {{D\left( {i,{j - 1}} \right)} + V} \\ {{A\left( {i,{j - 1}} \right)} + V_{V}} \end{matrix}{if}i} = 0} \right.}$ ${A\left( {i,j} \right)} = {\max\left\{ {{\begin{matrix} {{D\left( {i,{j - 1}} \right)} + v} \\ {{A\left( {i,{j - 1}} \right)} + v_{v}} \end{matrix}{if}i} \neq 0} \right.}$ ${B\left( {i,j} \right)} = {\max\left\{ {{\begin{matrix} {{D\left( {{i - 1},j} \right)} + H} \\ {{B\left( {{i - 1},j} \right)} + H_{H}} \end{matrix}{if}j} = 0} \right.}$ ${B\left( {i,j} \right)} = {\max\left\{ {{\begin{matrix} {{D\left( {{i - 1},j} \right)} + h} \\ {{B\left( {{i - 1},j} \right)} + h_{h}} \end{matrix}{if}j} \neq 0} \right.}$ H_(H) = H = 0 V_(V) = V = 0

2. The Fifth Embodiment—The Modular Based Dynamical Program Using a Customized Hardware for an Overlapping Alignment with Affine Gap Score

The fifth embodiment of modulo based, genetic material alignment methods is a hardware implementation for computing the key recursion equations with residues for an overlapping alignment with affine gap score. Because of its similarity to the global alignment with affine gap score, the Lemma 7.1 holds for the overlapping alignment as well, Lemma 7.2 for overlapping alignment gives the same result as Lemma 7.1 for global alignment. Proofs of Lemma 7.1 and 7.2 are provided below.

FIG. 13 illustrates the FA hardware of the fifth embodiment, according to various aspects of the present disclosure. With reference to FIG. 13 , an F_(A) hardware 609 is explained. The F_(A) hardware 609 in FIG. 13 , differs from the F_(A) hardware 601 in FIG. 9 in the following two aspects. The first difference is that the adder 602 input in FIG. 13 is:

$\left\{ \begin{matrix} (0000000) & {{{if}i} = 0} \\ {t_{b}\left( {6:0} \right)} & {{{if}i} > 0} \end{matrix} \right.$

But the adder 602 input in FIG. 9 is: t_(b)(6:0). Thus, the two inputs differ when i=0. The adder 602 input in FIG. 13 is all zeros for i=0. Therefore, when i=0, v_(V)=0 is added to A(i,j−1), according to the update rules.

The second difference is that the adder 603 input in FIG. 13 is:

$\left\{ \begin{matrix} (0000000) & {{{if}i} = 0} \\ {t_{a}\left( {6:0} \right)} & {{{if}i} > 0} \end{matrix} \right.$

But the adder 603 input in FIG. 9 is: t_(a)(6:0). Thus, the two inputs differ when i=0. The adder 603 input in FIG. 13 is all zeros for i=0. Therefore, when i=0, V=0 is added to E(i,j−1), according to the update rules.

FIG. 14 illustrates the FB hardware of the fifth embodiment, according to various aspects of the present disclosure. With reference to FIG. 14 , an F_(B) hardware 619 is explained. The F_(B) hardware 619 in FIG. 14 , differs from the F_(B) hardware 611 in FIG. 10 in the following two aspects. The first difference is that the adder 612 input in FIG. 14 is:

$\left\{ \begin{matrix} (0000000) & {{{if}j} = 0} \\ {t_{b}\left( {6:0} \right)} & {{{if}j} > 0} \end{matrix} \right.$

But the adder 612 input in FIG. 10 is t_(b)(6:0). Thus, the two inputs differ when j=0. The adder 612 input in FIG. 14 is all zeros for j=0. Thus, when j=0, H_(H)=0 is added to B(i−1,j), according to the update rules.

The second difference is that the adder 613 input in FIG. 14 is:

$\left\{ \begin{matrix} (0000000) & {{{if}j} = 0} \\ {t_{b}\left( {6:0} \right)} & {{{if}j} > 0} \end{matrix} \right.$

But the adder 613 input in FIG. 10 is: t_(a)(6:0). Thus, the two inputs differ when j=0. The adder 613 input in FIG. 14 is all zeros for j=0. Thus, when j=0, H=0 is added to E(i−1,j), according to the update rules. The F_(E) hardware of the overlapping alignment is identical with the F_(E) hardware of the global alignment shown in FIGS. 11A and 11B.

H. Local Alignment

Some embodiments of the present modulo based, genetic material alignment methods provide a hardware implementation for computing the key recursion equations with residues for a local alignment with affine gap score.

2. The Goal of the Local Alignment

Given two sequences x=x₁ x₂ x₃ . . . x_(n) and y=y₁ y₂ y₃ . . . y_(m), the x and y alignment digraph D(x,y) with vertex set

, and the score maps {circumflex over (φ)}₀ and {circumflex over (φ)}₁, the goal of the local alignment is to find a walk, W^(max), starting from a vertex (i₀,j₀) ending on a vertex (i_(k),j_(k)) on the alignment digraph D(x,y), such that W^(max)=((i₀,j₀), (i₁,j₁), . . . , (i_(k),j_(k))), has a maximal score.

The score functions {circumflex over (φ)}₀ and {circumflex over (φ)}₁ are as defined earlier. An affine gap score with values in Table 3 may be used. For the local alignment with affine gap score, D(i,j) is the best score over all walks to (i,j). If no such walk exists, then D(i,j)=−Inf, A(i,j) is the best score over all walks to (i,j) that end with a vertical arc. If no such walk exists, then A(i,j)=−Inf, and B(i,j) is the best score over all walks to (i,j) that end with a horizontal arc. If no such walk exists, then B(i,j)=−Inf.

The following initialization may be performed: E(0,0)=0 E(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0 A(0,0)=−Inf A(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0 B(0,0)=−Inf B(k ₁ ,k ₂)=−Inf if k ₁<0 or k ₂<0

Update Rules:

(i, j) ≠ (0, 0) ${E\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {{i - 1},{j - 1}} \right)} + {\kappa\left( {x_{i},y_{j}} \right)}} \\ {A\left( {i,j} \right)} \\ {B\left( {i,j} \right)} \\ 0 \end{matrix} \right.}$ ${A\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {i,{j - 1}} \right)} + v} \\ {{A\left( {i,{j - 1}} \right)} + v_{v}} \\ 0 \end{matrix} \right.}$ ${B\left( {i,j} \right)} = {\max\left\{ \begin{matrix} {{E\left( {{i - 1},j} \right)} + h} \\ {{B\left( {{i - 1},j} \right)} + h_{h}} \\ 0 \end{matrix} \right.}$ (k₁, k₂) = −Infifk₁ < 0ork₂ < 0

3. The Sixth Embodiment—The Modular Based Dynamical Program Using a Customized Hardware for a Local Alignment with Affine Gap Score

The sixth embodiment of modulo based, genetic material alignment methods is a hardware implementation for computing the key recursion equations with residues for a local alignment with affine gap score. FIG. 15 illustrates the FA hardware of the sixth embodiment, according to various aspects of the present disclosure. FIG. 16 illustrates the FB hardware of the sixth embodiment, according to various aspects of the present disclosure. FIG. 17 illustrates the FE hardware of the sixth embodiment, according to various aspects of the present disclosure.

With reference to FIGS. 15-17 , the sixth embodiment is explained. In the local alignment with affine gap score, there are 3 main equations in the key recursion equations. Each equation requires finding a maximal element of a set.

1) A(i,j) equals a maximal element of a set Set_(A(i,j))={A(i,j−1)+v_(v), E(i,j−1)+v,0}

2) B(i,j) equals a maximal element of Set_(B(i,j))={B(i−1,j)+h_(h), E(i−1,j)+h,0}

3) E(i,j) equals a maximal element of Set_(E(i,j))={A(i,j), B(i,j), E(i−1,j−1)+κ(x_(i),y_(j)),0}

Again, let res(A(i,j−1),

), res(B(i−1,j),

), res(E(i,j−1),

), res(E(i−1,j),

), res(E(i−1,j−1),

), res(A(i,j−1)+v _(v),

), res(B(i−1,j)+h _(h),

), res(E(i,j−1)+v,

), res(E(i−1,j)+h,

), and res(E(i−1,j−1)+κ(x _(i) ,y _(j)),

),

to denote the residues of A(i,j−1), B(i−1,j), E(i,j−1), E(i−1,j), E(i−1,j−1), A(i,j−1)+v_(v), B(i−1,j)+h_(h)t, E(i,j−1)+v, E(i−1,j)+h, and E(i−1,j−1)+κ(x_(i),y_(j)), respectively, with respect to a modulus

.

Let's define R₁-R₅ and r₁-r₅ as follows: R ₁ =A(i,j−1)+v _(v) R ₂ =E(i,j−1)+v R ₃ =B(i−1,j)+h _(h) R ₄ =E(i−1,j)+h R ₅ =E(i−1,j−1)+κ(x _(i) ,y _(j)) r ₁=res(A(i,j−1)+v _(v),

), r ₂=res(E(i,j−1)+v,

), r ₃=res(B(i−1,j)+h _(h),

), r ₄=res(E(i−1,j)+h,

), r ₅=res(E(i−1,j−1)+κ(x _(i) ,y _(j)),

).

The present disclosure gives the following 3 functions, F_(A), F_(B), and F_(E) for generating the followings: [res(A(i,j)

),k _(A(i,j)) ,I _(A(i,j)) ]=F _(A)(res(A(i,j−1),

),k _(A(i,j−1)),res(E(i,j−1),

)),k _(E(i,j−1))) [res(B(i,j),

),k _(B(i,j)) ,I _(B(i,j)) ]=F _(A)(res(B(i−1,j),

),k _(B(i−)1,j),res(E(i−1,j),

)),k _(E(i−1,j))) [res(E(i,j),

),k _(E(i,j)) ,I _(E(i,j))]= F _(E)(res(E(i−1,j−1),

),k _(E(i−1,j−1)),res(A(i,j),

)k _(A(i,j−1)) ,k _(E(i,j−1)),res(B(i,j),

),k _(B(i−1,j)) ,k _(E(i−1,j))) Where, A(i,j)=k _(A(i,j))×

+res(A(i,j),

),0≤res(A(i,j),

)<

B(i,j)=k _(B(i,j))×

+res(B(i,j),

),0≤res(B(i,j),

)<

E(i,j)k _(E(i,j))×

+res(E(i,j),

),0≤res(E(i,j),

)<

I_(A(i,j)) is the index to the maximal element in Set_(A(i,j)), that is I_(A(i,j))=1 if the first element in Set_(A(i,j)) is the maximal element, I_(A(i,j))=2 if the second element in Set_(A(i,j)) is the maximal element, and I_(A(i,j))=3 if the third element in Set_(A(i,j)) is the maximal element.

I_(B(i,j)) is the index to the maximal element in Set_(B(i,j)),

I_(E(i,j)) is the index to the maximal element in Set_(E(i,j)).

I_(A(i,j)), I_(A(i,j)), and I_(A(i,j)) are stored for trackback.

Also let I′_(A(i,j)), I′_(B(i,j)), and I′_(E(i,j)) to denote a maximal element in Set_(A(i,j))−{0}, Set_(B(i,j))−{0}, and Set_(E(i,j))−{0}, respectively.

Again, let's denote the 2's complement representation of x by t_(x). [res(A(i,j),

),k _(A(i,j)) ,I _(A(i,j)) ]=F _(A)(res(A(i,j−1),

),k _(A(i,j−1)),res(E(i,j−1),

)),k _(E(i,j−1)))

Now F_(A) decides on max {R₁, R₂, 0}, based on {r₁, r₂} using the conditions of Lemma 10 and quotients k_(A(i,j−1)) and k_(E(i,j−1)).

Conditions of the Lemma 10:

$\left\{ \begin{matrix} {R_{1} > R_{2}} & {{{if}r_{2}} < r_{1} \leq {r_{2} + Q}} \\ {R_{1} < R_{2}} & {{{{if}r_{2}} + Q} < r_{1}} \\ {R_{1} < R_{2}} & {{{if}r_{1}} < r_{2} \leq {r_{1} + Q}} \\ {R_{1} > R_{2}} & {{{{if}r_{1}} + Q} < r_{2}} \\ {R_{1} = R_{2}} & {{{if}r_{1}} = r_{2}} \end{matrix} \right.$

And F_(B) decides on max {R₃, R₄, 0}, based on {r₃, r₄} using the conditions of Lemma 10 and quotients k_(B(i−1,j)) and k_(E(i−1,j)).

Conditions of the Lemma 10:

$\left\{ \begin{matrix} {R_{3} > R_{4}} & {{{if}r_{4}} < r_{3} \leq {r_{4} + Q}} \\ {R_{3} < R_{4}} & {{{{if}r_{4}} + Q} < r_{3}} \\ {R_{3} < R_{4}} & {{{if}r_{3}} < r_{4} \leq {r_{3} + Q}} \\ {R_{3} > R_{4}} & {{{{if}r_{3}} + Q} < r_{4}} \\ {R_{3} = R_{4}} & {{{if}r_{3}} = r_{4}} \end{matrix} \right.$

And F_(E) decides on max{A(i,j),B(i,j),R₅,0}, based on {res(A(i,j),

),res(B(i,j),

),r₅} and the conditions of Lemma 10 and quotients k_(A(i,j−1)), k_(B(i−1,j)), k_(E(i,j−1)), k_(E(i−1,j)) and k_(E(i−1,j−1)).

The gist approach is

-   -   1) to use the residues to find the partial indexing variables         I′_(A(i,j)), I′_(B(i,j)), and I′_(E(i,j)), and     -   2) to use the quotients to complete the variables, I_(A(i,j)),         I_(B(i,j)), and I_(E(i,j)).

Part 1) is done with short registers holding the residues, and most of Part 2) is done with slower logic. Therefore, the requirement on fast registers or fast memory units is lowered. In addition, the slower part not only use less power and therefore generates less heat, but also by reducing the overall power consumption and heat produced, it allows faster operation

The sixth embodiment provides a hardware implementation of the above process. The residues may be represented in 2's complement, and the example 2 parameters for DNA segment alignment may be used. Thus, the match score=κ_(max)=1, the mis-match score=κ_(min)=−5, and the opening gap score=α+β=5.

Lemma 7.1 holds for the sixth embodiment. Lemma 7.3 for local alignment and Lemma 7.1 for global alignment produce the same results. Thus, from Lemma 7.1: Q=27 (see above). Thus, the modulus

may be picked to be

≥2*Q+1=55.

may be selected to be

=64=2⁶, to ease the hardware architecture.

Therefore, there may be 7 bits 2's complement representation to handle mod 2⁶. The 2's complement representation of x may be denoted by t_(x). It should be noted that β, α+β, and κ(x_(i),y_(j)) are in the range [−2⁶+1, 2⁶−1].

Referring to FIG. 15 , a F_(A) hardware 850 is explained. The F_(A) hardware 850 may comprise three 7-bit adders 852, 853, and 854, a multiplexer 855, a select unit 857 and a map-A 858. The inputs to the adder 852 may be

(6:0) and t_(−β)(6:0). A carry signal to the adder 851 may be ‘0’.

The output of the adder 852 may be t₁ (6:0), where (0 t₁(5:0)) is

(6:0), which is the 2's complement of residue of A(i,j−1)−β modulo

, where t₁(6)=1 if t₁(6:0) represent a negative number 7-bit, 2's complement.

The inputs to the adder 853 may be

(6:0) and t_(−β−α)(6:0). A carry signal to the adder 853 may be ‘0’. The output of the adder 853 may be t₂(6:0), where (0 t₂(5:0)) is

(6:0), which is the 2's complement of residue of E(i,j−1)−β−α modulo

, where t₂(6)=1 if t₂(6:0) represent a negative number 7-bit, 2's complement.

The inputs to the adder 854 may be (0 t₂(5:0)) and (0 t₁(5:0)). The output of the adder 853, (0 t₂(5:0)), may be complemented by a not gate 856 before entering the adder 854. A carry signal to the adder 854 may be ‘1’.

In this shape, the adder 854 may function as a 2's complement subtractor. The adder 854 may generate, t₁₂(6:0), which (0 t₁(5:0))−(0 t₂(5:0)) in 2's complement. The adder 854 may output t₁₂(6:0) and a zero flag, which is ‘0’ unless t₁₂(6:0)=(0,0,0,0,0,0,0). The main function of the adder 854 may be to generate I′_(A).

Recall:

if R₁>R₂ I′_(A)=1

if R₁<R₂ I′_(A)=2

if R₁=R₂ I′_(A)=we choose 1, without loss of generality

The adder 854 generates I′_(A), based on r₁ and r₂, using the conditions of the Lemma 10, where r₁=res(A(i,j−1)+v_(v),

) and r₂ res(E(i,j−1)+v,

).

$\left\{ \begin{matrix} {R_{1} > R_{2}} & {{{if}r_{2}} < r_{1} \leq {r_{2} + Q}} \\ {R_{1} < R_{2}} & {{{{if}r_{2}} + Q} < r_{1}} \\ {R_{1} < R_{2}} & {{{if}r_{1}} < r_{2} \leq {r_{1} + Q}} \\ {R_{1} > R_{2}} & {{{{if}r_{1}} + Q} < r_{2}} \\ {R_{1} = R_{2}} & {{{if}r_{1}} = r_{2}} \end{matrix} \right.$

In terms of t₁₂: R ₁ >R ₂ if t ₁₂(6)=0 and t ₁₂(5)=0 and zero flag=‘0’ R ₁ <R ₂ if t ₁₂(6)=0 and t ₁₂(5)=1 R ₁ <R ₂ if t ₁₂(6)=1 and t ₁₂(5)=1 R ₁ >R ₂ if t ₁₂(6)=1 and t ₁₂(5)=0 R ₁ =R ₂ zero flag=‘1’

Above, the inequality |R₁−R₂|≤Q=27 is used. Thus, I′_(A)=1 if (t₁₂(6:5)=(0,0) and zero flag=‘0’) OR t₁₂(6:5)=(1,0) OR zero flag=‘1’, and I_(A)=2 if t₁₂(6:5)=(0,1) OR t₁₂(6:5)=(1,1). Therefore, I′_(A)=1 if t₁₂(5)=0, and I′_(A)=2 if t₁₂(5)=1.

Hence, the select unit 857 input are: t₁₂(6:0) and the zero flag, and its output is b₁₂=t₁₂(5) (the other input values are not necessary in this case and may be eliminated). The multiplexer 855 may receive:

(0 t₁(5:0))=

(6:0),

(0 t₂(5:0))=

(6:0), and b₁₂, and it outputs:

a₁₂=

(6:0), when b₁₂=0 and it outputs

a₁₂=

(6:0), when b₁₂=1.

The map-A 858 inputs are:

t₁(6), t₂(6), b₁₂, a₁₂,k_(A(i,j−1)), and k_(E(i,j−1)).

The map-A 858 performs the following:

$k_{A({i,j})}^{\prime} = \left\{ \begin{matrix} {{k_{A({i,{j - 1}})} - {{t_{1}(6)}{if}b_{12}}} = 0} \\ {{k_{E({i,{j - 1}})} - {{t_{2}(6)}{if}b_{12}}} = 1} \end{matrix} \right.$ t_(res(A(i, j),))(6 : 0) = a₁₂ $k_{A({i,j})} = \left\{ \begin{matrix} k_{A({i,j})}^{\prime} & {{{if}k_{A({i,j})}^{\prime}} \geq 0} \\ 0 & {{{if}k_{A({i,j})}^{\prime}} < 0} \end{matrix} \right.$ ${t_{{res}({{A({i,j})},})}\left( {6:0} \right)} = \left\{ \begin{matrix} {t_{{res}({{A({i,j})},})}\left( {6:0} \right)} & {{{if}k_{A({i,j})}^{\prime}} \geq 0} \\ (0000000) & {{{if}k_{A({i,j})}^{\prime}} < 0} \end{matrix} \right.$ $I_{A({i,j})} = \left\{ \begin{matrix} I_{A}^{\prime} & {{{if}k_{A({i,j})}^{\prime}} \geq 0} \\ 3 & {{{if}k_{A({i,j})}^{\prime}} < 0} \end{matrix} \right.$

Although the quotients k_(A(i,j−1)) and k_(E(i,j−1)) are used in the F_(A) hardware 850, nevertheless, (1) the additions k_(A(i,j−1))−t₁(6) and k_(E(i,j−1))−t₂(6) require mostly slower operation than other arithmetic, as explained later, and (2) the condition k′_(A(i,j))≥0 may be checked quickly, as explained later. Therefore, the modulo based, genetic material alignment limits fast computing to mostly over the residues.

Referring to FIG. 16 , a F_(B) hardware 860 is explained. The F_(A) hardware 860 may comprise three 7-bit adders 862, 863, and 864, a multiplexer 865, a select unit 867 and a map-B 868. The inputs to the adder 862 may be

(6:0) and t_(−β)(6:0). A carry signal to the adder 861 may be ‘0’.

The output the adder 862 may be t₃ (6:0), where (0 t₃(5:0)) is

(6:0), which is the 2's complement of residue of B(i−1,j)−β modulo

, where t₃ (6)=1 if t₃(6:0) represent a negative number 7-bit, 2's complement. The inputs to the adder 863 may be

(6:0) and t_(−β−α)(6:0). A carry signal to the adder 863 may be ‘0’.

The output of the adder 863 may be t₄ (6:0), where (0 t₄(5:0)) is

(6:0), which is the 2's complement of residue of E(i−1,j)−β−α modulo

, where t₄(6)=1 if t₄(6:0) represent a negative number 7-bit, 2's complement.

The inputs to the adder 864 may be (0 t₄(5:0)) and (0 t₃(5:0)). The output of the adder 863, (0 t₄(5:0)) may be complemented by a not gate 866 before entering the adder 864. A carry signal to the adder 864 may be ‘1’.

In this shape, the adder 864 may function as a 2's complement subtractor. The adder 864 generates, t₃₄(6:0), which (0 t₃(5:0))−(0 t₄(5:0)) in 2's complement. The adder 864 outputs t₃₄(6:0) and a zero flag, which is ‘0’ unless t₃₄(6:0)=(0,0,0,0,0,0,0). The main function of the adder 864 may be to generate I′_(B).

Recall:

if R₃>R₄ I′_(B)=1

if R₃<R₄ I′_(B)=2

if R₃=R₄ I′_(B)=we choose 1, without loss of generality

The adder 864 generates I′_(B), based on r₃ and r₄, using the conditions of the Lemma 10, where r₃=res(B(i−1,j)+h_(h),

) and r₄=res(E(i−1,j)+h,

).

$\left\{ \begin{matrix} {R_{3} > R_{4}} & {{{if}r_{4}} < r_{3} \leq {r_{4} + Q}} \\ {R_{3} < R_{4}} & {{{{if}r_{4}} + Q} < r_{3}} \\ {R_{3} < R_{4}} & {{{if}r_{3}} < r_{4} \leq {r_{3} + Q}} \\ {R_{3} > R_{4}} & {{{{if}r_{3}} + Q} < r_{4}} \\ {R_{3} = R_{4}} & {{{if}r_{3}} = r_{4}} \end{matrix} \right.$

In terms of t₃₄: R ₃ >R ₄ if t ₃₄(6)=0 and t ₃₄(5)=0 and zero flag=‘0’ R ₃ <R ₄ if t ₃₄(6)=0 and t ₃₄(5)=1 R ₃ <R ₄ if t ₃₄(6)=1 and t ₃₄(5)=1 R ₃ >R ₄ if t ₃₄(6)=1 and t ₃₄(5)=0 R ₃ =R ₄ zero flag=‘1’

Above, the inequality |R₃−R₄|≤Q=27 is used. Thus,

I′_(B)=1 if (t₃₄(6:5)=(0,0) and zero flag=‘0’) OR t₃₄(6:5)=(1,0) OR zero flag

I′_(B)=2 if t₃₄(6:5)=(0,1) OR t₃₄(6:5)=(1,1)

Therefore, I′_(B)=1 if t₃₄(5)=0, and I′_(B)=2 if t₃₄(5)=1. Hence, the select unit 867 input are: t₃₄(6:0) and the zero flag, and its output is b₃₄=t₃₄(5) (the other input values are not necessary in this case and may be eliminated).

The multiplexer 865 may receive the followings:

(0 t₃ (5:0))=

(6:0),

(0 t₄(5:0))=

(6:0), and b₃₄, and it outputs:

a₃₄=

(6:0), when b₃₄=0 and it outputs

a₃₄=

(6:0), when b₃₄=1.

The map-B 868 inputs are:

t₃(6), t₄(6), b₃₄, a₃₄,k_(B(i−1,j)), and k_(E(i−1,j)).

The map-B 868 performs the following:

$k_{B({i,j})}^{\prime} = \left\{ {{\begin{matrix} {{k_{B({{i - 1},j})} - {{t_{3}(6)}{if}b_{34}}} = 0} \\ {{k_{E({{i - 1},j})} - {t_{4}(6){if}b_{34}}} = 1} \end{matrix}\left( {6:0} \right)} = {{a_{34}k_{B({i,j})}} = \left\{ {{\begin{matrix} {{k_{B({i,j})}^{\prime}{if}k_{B({i,j})}^{\prime}} \geq 0} \\ {{0{if}k_{B({i,j})}^{\prime}} < 0} \end{matrix}\left( {6:0} \right)} = \left\{ \begin{matrix} {{\left( {6:0} \right){if}k_{B({i,j})}^{\prime}} \geq 0} \\ {{(0000000){if}k_{B({i,j})}^{\prime}} < 0} \end{matrix} \right.} \right.}} \right.$

$I_{B({i,j})} = \left\{ \begin{matrix} {{I_{B}^{\prime}{if}k_{B({i,j})}^{\prime}} \geq 0} \\ {{3{if}k_{B({i,j})}^{\prime}} < 0} \end{matrix} \right.$

Now,

1) the additions k_(B(i−1,j))−t₃(6) and k_(E(i−1,j))−t₄(6) require mostly slower operation than other arithmetic, as explained later.

2) the condition k′_(B(i,j))≥0 may be checked quickly, as explained later.

Referring to FIG. 17 , a F_(E) hardware 870 is explained.

The F_(E) hardware 870 comprises a 7-bit adder 873, a 3 way compare 874, a multiplexer 875, and a map-E 877.

The inputs to the adder 873 are:

(6:0) and t_(κ(x) _(i) _(,y) _(j) ₎(6:0).

A carry signal to the adder 873 is ‘0’.

The output of the adder 873 is t₅ (6:0), where (0 t₅(5:0)) is

(6:0), which is the 2's complement of residue of E(i−1,j−1)+κ(x_(i),y_(j)) modulo

, t₅(6)=1 if t₅(6:0) represent a negative number 7-bit, 2's complement.

The compare 874 has 3 inputs:

,

, and

. The compare 874 finds I′_(E) based on its inputs using Lemma 10. In this example there is an arbitrarily bias, first toward A, next toward B, as follows: I′ _(E)=1 if A(i,j)≥B(i,j) and A(i,j)≥R ₅ I′ _(E)=2 if A(i,j)<B(i,j) and B(i,j)≥R ₅ I′ _(E)=3 if A(i,j)<R ₅ and B(i,j)<R ₅

The compare 874 outputs Control=I′_(E).

The multiplexer 875 receives:

,

, and.

(0 t₅(5:0))=

, and Control, and it outputs a′, where

a′=

(6:0), when Control=1, it outputs

a′=

(6:0), when Control=2, and it outputs

a′=

(6:0), when Control=3.

The map-E 877 inputs are:

t₁(6), t₂(6), t₃(6), t₄(6), t_(κ(x) _(i) _(,y) _(j) ₎(6), b₁₂, b₃₄, Control, a′, k_(A(i,j−1)), k_(E(i,j−1)), k_(B(i−1,j)), k_(E(i−1,j)) and k_(E(i−1,j−1)).

The map-E 877 performs the following:

$k_{E({i,j})}^{\prime} = \left\{ {{\begin{matrix} {{k_{A({i,{j - 1}})} - {{t_{1}(6)}{if}{Control}}} = {{1{and}b_{12}} = 0}} \\ {{k_{E({i,{j - 1}})} - {t_{2}(6){if}{Control}}} = {{1{and}b_{12}} = 1}} \\ {{k_{B({{i - 1},j})} - {{t_{3}(6)}{if}{Control}}} = {{2{and}b_{34}} = 0}} \\ {{k_{E({{i - 1},j})} - {t_{4}(6){if}{Control}}} = {{2{and}b_{34}} = 1}} \\ {{k_{E({{i - 1},{j - 1}})} - {{t_{5}(6)}{if}{Control}}} = {{3{and}{t_{\kappa({x_{i},y_{j}})}(6)}} = 0}} \\ {{k_{E({{i - 1},{j - 1}})} + {{t_{5}(6)}{if}{Control}}} = {{3{and}{t_{\kappa({x_{i},y_{j}})}(6)}} = 1}} \end{matrix}\left( {6:0} \right)} = {{a^{\prime}k_{E({i,j})}} = \left\{ {{\begin{matrix} {{k_{E({i,j})}^{\prime}{if}k_{E({i,j})}^{\prime}} \geq 0} \\ {{0{if}k_{E({i,j})}^{\prime}} < 0} \end{matrix}{t_{{res}({{E({i,j})},\mathcal{M}})}\left( {6:0} \right)}} = \left\{ {{\begin{matrix} {{\left( {6:0} \right){if}k_{E({i,j})}^{\prime}} \geq 0} \\ {{(0000000){if}k_{E({i,j})}^{\prime}} < 0} \end{matrix}I_{E({i,j})}} = \left\{ \begin{matrix} {{I_{E}^{\prime}{if}k_{E({i,j})}^{\prime}} \geq 0} \\ {{4{if}k_{E({i,j})}^{\prime}} < 0} \end{matrix} \right.} \right.} \right.}} \right.$

For X∈{A(i,j−1), B(i−1,j), E(i,j−1), E(i−1,j), E(i−1,j−1)},

A quotient k_(X) may be stored in two parts:

k_(X)=k′_(X)+k″_(X), where k″_(X) belongs to {0,1, −1}.

And s∈{0, −1, +1} may be added to k_(X) as follows.

$\left\{ \begin{matrix} {{{add}s{to}k_{X}^{\prime}{if}k_{X}^{''}} + {s{exits}\left\{ {0,{- 1},{+ 1}} \right\}}} \\ {{{add}s{to}k_{X}^{''}{if}k_{X}^{''}} + {s{remains}{in}\left\{ {0,{- 1},{+ 1}} \right\}}} \end{matrix} \right.$

It requires a bigger fluctuation of X to change k′_(X) than k″_(X).

In the local alignment application, some of the present embodiment keep k′_(X)≥0, where k′_(X) may be updated with a slower clock than k″_(X). Also a negative flag may be generated quickly for k_(X):

k_(X)<0 if

k′_(X)=0 and k″_(X)=0 and s=−1,

k′_(X)=1 and k″_(X)=−1 and s=−1,

The case k′_(X)=0 and k″_(X)=−1 and s=−1, does not occur in local alignment since k_(X) is nulled every time it goes below zero. Therefore k′_(X)=0 and k″_(X)=−1 would have led to k′_(X)=0 and k″_(X)=0 before receiving s=−1.

Another way to store a quotient k_(X) in two parts is to have k″_(X) in 2-bit 2's complement. Here s∈{0, −1, +1} may be added to k_(X) as follows: s∈{0, −1, +1} may be added to k″_(X), and overflows may be passed to k′_(X). Again, it requires a bigger fluctuation of X to change k′_(X) than k″_(X).

Yet another way is to do addition to k_(X) in three or more stages cascaded to each other, where overflows are carried to the next stage.

These methods split the addition into a faster part and a slower part. Overall making addition fast.

It should be noted that residues may be formed with respect to a modulus that is negative. the above examples used {0, 1, 2, . . . , M−1} for the domain of the residues, one may use a domain with an offset. For example, d+{0, 1, 2, . . . , M−1}. Residue methods may be applied to multi-sequence alignment of DNA sequences as well. Instead of breaking ties when sets have more than one maximal element, all maximal elements may be stored. This may allow the construction of more than one optimum alignment.

Further, the residue methods may be used when the key recursions equations are finding minimal elements instead of maximal elements. The lemmas 2 and 3 enable comparing the variables in the recursion equations, thus, they may be used to find the larger elements as well as the smaller elements. In the alignment literature, there is an equivalency between maximizing “similarity” score and minimizing “distance” scores.

The followings sections provide the proofs for the embodiments described above.

II. Abridged Proof of Global Alignments According to the Present Invention

Here Lemma i.1, i=1-7 are used that are given below. Two vertices A and B are given, A is to the immediate right of B. In Lemma 1.1-lower bound, described above, a lower bound is found for ρ(A)−ρ(B), for each of the affine, simplified and modified versions. In Lemma 1-upper bound, described above, an upper bound is found for ρ(A)−ρ(B), for each of the affine, simplified and modified versions.

Two vertices A and C are given, A is immediately below C. In Lemma 2.1-Lower bound, described above, a lower bound is found for ρ(C)−σ(A), for each of the affine, simplified and modified versions. In Lemma 2.1-upper bound, described above, an upper bound is found for ρ(C)−σ(A), for each of the affine, simplified and modified versions.

Using Lemmas 1.1 and 2.1 results lemma 3.1-6.1 are obtained, as described above, for affine, simplified and modified cases. Using Lemmas 1.1-6.1, a bound is generated for modulus operation for affine (Gotoh) algorithm in Lemma 7.1, as described below.

Difference of any pair of values from 1)-5) falls in the range:

[LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)}, and κ_(max)≥0

1) ρ(A)+κ(B), 2) ρ(B)−(α+β), 3) σ(B)−β, 4) ρ(C)−(α+β), 5) τ(C)−β

Next, we show that the Lemmas 1.1-7.1 apply for the banded global alignment. Therefore, the results extend to the banded global alignment case, as described in the Banded Global Alignment section, above.

A. Lemma 1.1—Lower Bound

Given vertices B=(i,j) and A=(i+1,j), we have −α−β≤ρ(A)−ρ(B), for affine and affine simplified gap score, and min{−α−β, κ_(min)+β}≤ρ(A)−ρ(B), for modified gap score.

Proof: Global alignment produces the same bound as the Local alignment, thus the proof is skipped for brevity. See Lemma 1.3, lower bound in Local alignment.

B. Lemma 1.1—Upper Bound

Given vertices B=(i,j) and A=(i+1,j), ρ(A)−ρ(B)≤κ_(max)+α+β, for affine and affine simplified gap score, and ρ(A)−ρ(B)≤κ_(max)−κ_(min), for modified gap score.

Proof: Global alignment produces the same bound as the Local alignment, thus we skip the proof for brevity. See Lemma 1.3, upper bound in Local alignment.

Global Alignment

affine modified simplified Lemma 1.1 −α − β min {−α − β, κ_(min) + β} −α − β lower bound Lemma 1.1 κ_(max) + α + β max{κ_(max) + α + κ_(max) + α + β upper bound β, −β, −β + κ_(max) − κ_(min)}

Global Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 1.1 −α − β min {−α − β, κ_(min) + β} −α − β lower bound Lemma 1.1 κ_(max) + α + β max{κ_(max) + α + β, −β + κ_(max) + α + β upper bound κ_(max) − κ_(min)}

C. Lemma 2.1—Lower Bound

We are given vertices C=(i,j) and A=(i,j+1), where ρ(C) denotes the best score from (0,0) to C, and σ(A) denotes the best score from (0,0) to A, over walks ending with a vertical arc. This lemma shows, 0≤ρ(C)−σ(A), for AS and M gap scores.

Proof: Global alignment produces the same bound as the Local alignment, thus we skip the proof for brevity. See Lemma 2.3, lower bound in Local alignment.

D. Lemma 2.1—Upper Bound

We are given vertices C=(i,j) and A=(i,j+1), where ρ(C) denotes the best score from (0,0) to C, and σ(A) denotes the best score from (0,0) to A, over walks ending with a vertical arc. This lemma shows, ρ(C)−σ(A)≤α+β, for AS and ρ(C)−σ(A)≤max{κ_(max)−κ_(min)+α+β, κ_(max)−2κ_(min)+α−β}, for M gap scores. (κ_(min)≤0 and κ_(max)≥0).

Proof: Global alignment produces the same bound as the Local alignment, thus we skip the proof for brevity. See Lemma 2.3, upper bound in Local alignment.

Global Alignment

affine Modified simplified Lemma 2.1 0 0 0 lower bound Lemma 2.1 α + β max{α + β, −κ_(min) + α, κ_(max) − κ_(min) + α + β upper bound (α + β), κ_(max) − 2κ_(min) + α − β}

Global Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 2.1 0 0 0 lower bound Lemma 2.1 α + β max{κ_(max) − κ_(min) + (α + β), α + β upper bound κ_(max) − 2κ_(min) + α − β}

E. Lemma 3.1-7.1

Given the upper and lower bounds in Lemmas 1 and 2, we drive four more set of lower and upper bounds.

We have six vertices X, Y, A, B, C, and D. A is immediately above C, and X is immediately above A. D is immediately to the right of C, B is immediately to the right of A, and Y is immediately to the right of X.

Proof:

affine modified simplified Lemma 1.1 −α − β min {−α − β, κ_(min) + β} −α − β lower bound L₁ Lemma 1.1 κ_(max) + α + β max{κ_(max) + α + β, −β + κ_(max) + α + β upper bound κ_(max) − κ_(min)} U₁ Lemma 2.1 0 0 0 lower bound L₂ Lemma 2.1 α + β κ_(max) − 2κ_(min) + α + β α + β upper bound U₂ Lemma 1.1 L₁ ≤ ρ(B) − ρ(A) ≤ U₁ L₁ ≤ ρ(C) − ρ(A) ≤ U₁ Lemma 2.1 L₂ ≤ ρ(B) − σ(D) ≤ U₂ L₂ ≤ ρ(C) − τ(D) ≤ U₂ Lemma 3.1 L₃ = L₁ + L₂ ≤ ρ(B) − σ(B) ≤ U₁ + U₂ = U₃ L₃ = L₁ + L₂ ≤ ρ(C) − τ(C) ≤ U₁ + U₂ = U₃ Lemma 4.1 −U₁ + L₃ ≤ ρ(A) − σ(B) ≤ −L₁ + U₃ −U₁ + L₃ ≤ ρ(A) − τ(C) ≤ −L₁ + U₃ Lemma 5.1 −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ Lemma 6.1 L₁ − U₁ + L₃ ≤ ρ(B) − τ(C) ≤ U₁ − L₁ + U₃ L₁ − U₁ + L₃ ≤ ρ(C) − σ(B) ≤ U₁ − L₁ + U₃

1. Lemma 3.1: ρ(B)−σ(B)=ρ(B)−ρ(Y)+ρ(Y)−σ(B) L ₁ +L ₂≤ρ(B)−σ(B)≤U ₁ +U ₂

2. Lemma 4.1: ρ(A)−σ(B)=ρ(A)−ρ(B)+ρ(B)−σ(B) −U ₁ +L ₃≤ρ(A)−σ(B)≤−L ₁ +U ₃

3. Lemma 5.1: ρ(B)−σ(C)=ρ(B)−ρ(A)+ρ(A)−σ(C) −U ₁ +L ₁≤ρ(B)−ρ(C)≤−L ₁ +U ₁

4. Lemma 6.1 and Lemma 7.1: ρ(B)−τ(C)=ρ(B)−ρ(A)+ρ(A)−ρ(C)+ρ(C)−σ(C) L ₁ −U ₁ +L ₃≤ρ(B)−τ(C)≤U ₁ −L ₁ +U ₃

For Affine (Gotoh) gap score, we generate the table below based on above results.

Gotoh L ₁=−(α+β) U ₁=κ_(max)+α+β, κ_(max)≥0 L ₂=0 U ₂=(α+β)

Lemma 1.1 −(α + β) ≤ ρ(B) − ρ(A) ≤ κ_(max) + (α + β) −(α + β) ≤ ρ(C) − ρ(A) ≤ κ_(max) + (α + β) Lemma 2.1 0 ≤ ρ(B) − σ(D) ≤ (α + β) 0 ≤ ρ(C) − τ(D) ≤ (α + β) Lemma 3.1 −(α + β) ≤ ρ(B) − σ(B) ≤ κ_(max) + 2(α + β) −(α + β) ≤ ρ(C) − τ(C) ≤ κ_(max) + 2(α + β) Lemma 4.1 −κ_(max) − 2(α + β) ≤ ρ(A) − σ(B) ≤ κ_(max) + 3(α + β) −κ_(max) − 2(α + β) ≤ ρ(A) − τ(C) ≤ κ_(max) + 3(α + β) Lemma 5.1 −κ_(max) − 2(α + β) ≤ ρ(B) − ρ(C) ≤ κ_(max) + 2(α + β) −κ_(max) − 2(α + β) ≤ ρ(C) − ρ(B) ≤ κ_(max) + 2(α + β) Lemma 6.1 −κ_(max) − 3(α + β) ≤ ρ(B) − τ(C) ≤ 2κ_(max) + 4(α + β) −κ_(max) − 3(α + β) ≤ ρ(C) − σ(B) ≤ 2κ_(max) + 4(α + β)

Lemma 7.1: The difference of any pair of values 1)-5) below is in the interval:

[LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)}, and κ_(max)≥0

1) ρ(A)+κ(B), 2) ρ(B)−(α+β), 3) σ(B)−β, 4) ρ(C)−(α+β), 5) τ(C)−β.

Proof:

Difference of values 1) and 2): from Lemmas 1.1-6.1 −(α+β)≤ρ(B)−ρ(A)≤κ_(max)+(α+β) −(α+β)−(α+β)−κ(B)≤(ρ(B)−(α+β))−(ρ(A)+κ(B))≤κ_(max)+(α+β)−(α+β)−κ(B) −2(α+β)−κ(B)≤(ρ(B)−(α+β))−(ρ(A)+κ(B))≤κ_(max)−κ(B) −2(α+β)−κ_(max)≤(ρ(B)−(α+β))−(ρ(A)+κ(B))≤κ_(max)−κ_(min)

Difference of 1) and 3): from Lemmas 1.1-6.1 −κ_(max)−2(α+β)≤ρ(A)−σ(B)≤κ_(max)+3(α+β) −κ_(max)−2(α+β)+κ(B)+β≤(ρ(A)+κ(B))−(σ(B)−β)≤κ_(max)+3(α+β)+κ(B)+β −κ_(max)−2(α+β)+κ_(min)+β(ρ(A)+κ(B))−(σ(B)−β)2κ_(max)+3(α+β)+β

Difference of values 1) and 4) is same as difference of 1) and 2)

Difference of values 1) and 5) is same as difference of 1) and 3)

Difference of values 2) and 3): from Lemmas 1.1-6.1 −(α+β)≤ρ(B)−σ(B)≤κ_(max)+2(α+β) −(α+β)−(α+β)+β≤(ρ(B)−(α+β))−(σ(B)−β)≤κ_(max)+2(α+β)−(α+β)+β −2(α+β)+β≤(ρ(B)−(α+β))−(σ(B)−β)≤κ_(max)+(α+β)+β

Difference of values 2) and 4): from Lemmas 1.1-6.1 −κ_(max)−2(α+β)≤ρ(B)−ρ(C)≤κ_(max)+2(α+β) −κ_(max)−2(α+β)≤(ρ(B)−(α+β))−(ρ(C)−(α+β))κ_(max)+2(α+β) −κ_(max)−2(α+β)≤(ρ(B)−(α+β))−(ρ(C)−(α+β))κ_(max)+2(α+β)

Difference of values 2) and 5): from Lemmas 1.1-6.1 −κ_(max)−3(α+β)≤ρ(B)−τ(C)≤2κ_(max)+4(α+β) −κ_(max)−3(α+β)−(α+β)+β≤(ρ(B)−(α+β))−(τ(C)−β)≤2κ_(max)+4(α+β)−(α+β)+β −κ_(max)−4(α+β)+β≤(ρ(B)−(α+β))−(τ(C)−β)≤2κ_(max)+3(α+β)+β

Difference of values 23) and 4): Same as 2) and 5)

Difference of values 23) and 5): from Lemmas 1.1-6.1 −2κ_(max)−5(α+β)≤σ(B)−β−(τ(C)−β)=σ(B)−τ(C)≤2κ_(max)+5(α+β)

Difference of values 24) and 5): Same as 2) and 3)

Bound that satisfy all of the above is: [LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)}, and κ_(max)≥0

The above is repeated to obtain Lemma 3.1-7.1 for the simplified and modified versions.

We use the bound for values 1)-5) that include the score of the arcs.

Alternatively, it is possible to use a similar bound for values 1′)-5′) that do not include the score of the arcs. The overall expressions in of the recursion must be reduced to a modulus based on the bound used.

1′) ρ(A), 2′) ρ(B), 3′) σ(B), 4′) ρ(C), 5′) τ(C)

III. Banded Global Alignment Proof

The two sequences X and Y, and their alignment digraph D(x,y) are given. Let V={(i,j): 0≤i≤n and 0≤j≤m}, denote the vertex set of the digraph D(x,y) as described above. In banded alignment, only vertices BAND={(i,j): (i,j)∈V, and lower_bound≤i+j≤upper_bound}, are allowed for integers lower_bound and upper_bound. As described below, Lemma 1.1 lower bound, Lemma 1.1 upper bound, lemma 2.1 lower bound, and Lemma 2.1 upper bound hold for banded global alignments. Therefore, the results hold for banded global alignment.

For lemmas 2 lower bound (banded), the comments are included the proof. For lemmas 2 upper bound (banded) affine and simplified cases, the comments are included the proof. For the modified case: Let {circumflex over (σ)}(A) denote a best path in the band, reaching A with last arc vertical, and let denote a best path in the band, reaching C. Case 1) Subcase 1.a):

If C, A and W_({circumflex over (ρ)}(C)), belong to a band, then from the definition of a band, we have W

W_({circumflex over (ρ)}(C))*((i_(s),j_(s)+1)) belongs to the band. Therefore, the difference {circumflex over (ρ)}(C)−{circumflex over (ρ)}(A) holds over the band.

Case 1) Subcase 1.b) Sub-subcase 1.b.b) Part 1):

If C, A and W_({circumflex over (ρ)}(C)), belong to a band, then

W=W_({circumflex over (ρ)}(C))★((i_(p)+s,j_(p)+2)) ((i₀,j₀), . . . , (i_(p),j_(p)), (i_(p)+1,j_(p)+1−1), (i_(p)+2,j_(p)+1−1), . . . , (i_(p)+s−1,j_(p)+1−1), (i_(p)+s,j_(p)+1))★((i_(p)+s,j_(p)+2)) belongs to the band since all diagonals of the BAND that pass through that cover C, A and all the vertices of W_({circumflex over (ρ)}(C)), also cover all the vertices W. Therefore, the upper bound for {circumflex over (ρ)}(C)−{circumflex over (ρ)}(A) holds over the band.

Case 1) Subcase 1.b) Sub-subcase 1.b.b) Part 2):

If C, A and W_({circumflex over (ρ)}(C)), belong to a band, then

W=((i₀,j₀), . . . , (i_(p),j_(p)), (i_(p)+1,j_(p)+1−1), (i_(p)+2,j_(p)+1−1), . . . , (i_(p)+s−1,j_(p)+1−1), (i_(p)+s,j_(p)+1))★((i_(p)+s,j_(p)+2))={acute over (W)}_({circumflex over (ρ)}(C)))((i_(p),j_(p)))★((i_(p)+1,j_(p)+1−1), (i_(p)+2,j_(p)+1−1), . . . , (i_(p)+s−1,j_(p)+1−1), (i_(p)+s,j_(p)+1))★((i_(p)+s,j_(p)+2)) belongs to the band since all diagonals of the BAND that pass through that cover C, A and all the vertices of W_({circumflex over (ρ)}(C)), also cover all the vertices W. Therefore, the upper bound for {circumflex over (ρ)}(C)−{circumflex over (ρ)}(A) holds over the band.

Case 1) Subcase 1.b) Sub-subcase 1.b.b) Part 3):

If C, A and W_({circumflex over (ρ)}(C)), belong to a band, then

$W = \left\{ \begin{matrix} \left( {\left( {0,0} \right),\left( {1,1} \right),{{\left( {2,2} \right){\bigstar\left( \left( {2,3} \right) \right)}{if}s} = 2}} \right. \\ {{\left( {\left( {0,0} \right),\left( {1,1} \right),\left( {2,1} \right),\left( {3,2} \right)} \right){\bigstar\left( \left( {3,3} \right) \right)}{if}s} = 3} \\ {{\left( {\left( {0,0} \right),\left( {1,1} \right),\left( {{1 + 1},1} \right),\left( {{1 + 2},1} \right),\ldots,\left( {{1 + s - 2},1} \right),\left( {s,2} \right)} \right){\bigstar\left( \left( {s,3} \right) \right)}{if}2} > 3} \end{matrix} \right.$

belongs to the band since all diagonals of the BAND that pass through that cover C, A and all the vertices of W_({circumflex over (ρ)}(C)), also cover all the vertices W. Therefore, the upper bound for {circumflex over (ρ)}(C)−{circumflex over (ρ)}(A) holds over the band.

Case 1) Subcase 1.b) Sub-subcase 1.b.b) Part 4):

If C, A and W_({circumflex over (ρ)}(C)), belong to a band, then

W=((i₀,j₀), . . . , (i_(p−1),j_(p−1)), (i_(p)+1,j_(p)), (i_(p)+2,j_(p)), (i_(p)+3,j_(p)), . . . , (i_(p)+s−1,j_(p)), (i_(p)+s,j_(p)+1))★((i_(p)+s,j_(p)+2))={acute over (W)}_({circumflex over (ρ)}(C))((i_(p−1),j_(p−1)))★((i_(p)+1,j_(p)), (i_(p)+2,j_(p)), . . . , (i_(p)+s−1,j_(p)), (i_(p)+s,j_(p)+1))★((i_(p)+s,j_(p)+2)) belongs to the band since all diagonals of the BAND that pass through that cover C, A and all the vertices of W_({circumflex over (ρ)}(C)), also cover all the vertices W. Therefore, the upper bound for {circumflex over (ρ)}(C)−{circumflex over (ρ)}(A) holds over the band.

Case 2) If C and A belong to a band, then the upper bound for {circumflex over (ρ)}(C)−{circumflex over (ρ)}(A) holds over the band.

Lemmas 1 lower bound (banded):

In each case, replacing ρ(B) and W_(ρ(B)) with {circumflex over (ρ)}(B) and W_({circumflex over (ρ)}(B)), respectively. Then the walk W belongs to the BAND and thus generates the same upper bound for {circumflex over (ρ)}(A)−{circumflex over (ρ)}(B). W belongs to the BAND since diagonals that pass A, B and W_({circumflex over (ρ)}(B)) pass all vertices of W.

Lemmas 1 upper bound (banded):

In each case, replacing ρ(A) and W_(ρ(A)) with {circumflex over (ρ)}(A) and W_({circumflex over (ρ)}(B)), respectively. Now, in each case, by construction, the walk that reaches B is in the BAND, thus the same upper bound is obtained for {circumflex over (ρ)}(A)−{circumflex over (ρ)}(B).

1) Assume A, B and {circumflex over (ρ)}(A) belong to the BAND.

2) Now, given that the sequence denoted by (a) is in the BAND, then the sequence (n) is in the BAND because all its vertices belong to the diagonals that pass through {the vertices of (a)}U{B}. With the same argument, given sequences denoted by (b), (c), (d), (e), (f), (g), (h), (i), (j), (k), and (l) are in the BAND, then the sequences (o), (p), (q), (n), (o), (p), (q), (r), (s), (t), and (u) are in the BAND, respectively.

IV. Abridged Proof of Overlapping Alignments According to the Present Invention

Here Lemma i.2, i=1-7 are used that are given below. Note Lemmas 1.2-7.2 of the overlapping alignment are different than Lemmas 1.1-7.1 of the global alignment. Hoverer the bounds for affine (Gotoh) and affine simplified are the same as in Global alignment.

There are given two vertices A and B, A is to the immediate right of B.

In Lemma 1.2-lower bound for overlapping alignment, described above, a lower bound is found for ρ(A)−ρ(B), for each of the affine, simplified and modified versions.

In Lemma 1.2-upper bound for overlapping alignment, described above, an upper bound is found for ρ(A)−ρ(B), for each of the affine, simplified and modified versions.

There are given two vertices A and C, A is immediately below C.

In Lemma 2.2-lower bound for overlapping alignment, described above, a lower bound is found for ρ(C)−σ(A), for each of the affine, simplified and modified versions.

In Lemma 2.2-upper bound for overlapping alignment, described above, an upper bound is found for ρ(C)−σ(A), for each of the affine, simplified and modified versions.

Using Lemma 1.2 and 2.2 results Lemma 3.2-6.2 is obtained for affine, simplified and modified cases, as described above with reference to Lemmas 3.2-7.2 for overlapping alignment.

Using Lemmas 1.2-6.2 a bound is generate for modulus operation for affine (Gotoh) algorithm in Lemma 7.2, as described below.

Difference of any pair of values from 1)-5) falls in the range:

[LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)}, and κ_(max)≥0 κ_(max)≥0

1)ρ(A)+κ(B),2)ρ(B)−(α+β), 3) σ(B)−β, 4)ρ(C)−(α+β), 5)τ(C)−β

Next, it is shown that the Lemmas 1.2-7.2 apply for the banded overlapping alignment. Therefore, the results extend to the banded overlapping alignment case, as described above in the Banded Overlapping Alignment Section.

A. Lemma 1.2—Lower Bound

Given vertices B=(i,j) and A=(i+1,j), we have −α−β≤ρ(A)−ρ(B), for affine and affine simplified gap score, and min{−α−β, κ_(min)+β}≤ρ(A)−ρ(B), for modified gap score. Proof: Let row(B)=i and col(B)=j. Also, M denotes modified gap score and AS denotes Affine and simplified gap scores.

1. Case: Row(B)=0 and Col(B)≥0

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}.

B=(t,0), for an integer t, 0≤t≤n−1.

For AMS:

For B, we have ρ(B)=0, for all 0≤t≤n−1.

We have A=(t+1,0).

And ρ(A)=0, for all 0≤t≤n−1.

Thus, ρ(A)−ρ(B)=0, for all 0≤t≤n−1.

2. Case: Row(B)>0 and Col(B)=0

Vertex set of D(x,y) is

{(i,j), for 0≤i≤n and 0≤j≤m}.

C=(0,t), for an integer t, 0≤t≤m.

ρ(C)=0 for all t, as initialized.

We have B=(0,t), for 1<t≤m, hence A=(1, t).

For AMS: W _(ρ(B))=((0,0),(0,1), . . . ,(0,t)=B), t>0.

For B, we have ρ(B)=0. B=(i _(B) ,j _(B)) W=W _(ρ(B))★((1,t)) ρ(A)≥ S _(W) =S _(W) _(ρ(B)) +{circumflex over (φ)}₁(0t−1)(0,t),(0,t)(1t)= S _(W) _(ρ(B)) +h _(V)=ρ(B)+h _(V) h _(V)≤ρ(A)−ρ(B)

For A, h_(V)=h_(v). For M, h_(V)=h. For S, h_(V)=h.

3. Case: Row(B)>1 and Col(B)>1

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}.

B = (i_(B), j_(B)) W_(ρ(B)) = ((i₀, j₀), (i₁, j₁), … , (i_(s), j_(s)) = B), s > 1. W = W_(ρ(B))((i_(A), j_(A))) $\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{W_{\rho(B)}} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},{\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}}} \\ {= {{\overset{¯}{S}}_{W_{\rho(B)}} + h_{u}}} \\ {= {{\rho(B)} + h_{u}}} \end{matrix}$

For affine and simplified gap scores: h _(u)≤ρ(A)−ρ(B)

For x∈{d, h, v}, if (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(x), then u=x.

For modified gap score:

For u=d, both W_(ρ(B)) and W may be valid walks in M.

For u=h, both W_(ρ(B)) and W may be valid walks in M.

For u=v, W_(ρ(B)) may be a valid walk in M. But W is not a valid walk in M.

Thus, we need to find a new W.

Below is with modified gap score: {acute over (W)} _(ρ(B))(i _(l) ,j _(l)))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l))), for 0≤l≤s.

$W_{\rho(B)} = {{{\overset{´}{W}}_{\rho(B)}\left( \left( {i_{s - 1},j_{s - 1}} \right) \right)}\left( \left( {i_{s},j_{s}} \right) \right)}$ $W = {{{\overset{´}{W}}_{\rho(B)}\left( \left( {i_{s - 1},j_{s - 1}} \right) \right)}\left( \left( {i_{A},j_{A}} \right) \right)}$ $\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{A},j_{A}} \right)}} \right)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)}}} \end{matrix}$ $\begin{matrix} {{\rho(B)} = {\overset{¯}{S}}_{W_{\rho(B)}}} \\ {= {{\overset{¯}{S}}_{{\overset{¸}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}} \end{matrix}$ $\begin{matrix} {{{\rho(A)} - {\rho(B)}} \geq {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}} \\ {= {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - v_{z}}} \end{matrix}$ κ(x_(i_(A)), y_(j_(A))) − v_(z) ≤ ρ(A) − ρ(B)

if u=v and z=d, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(d)≤ρ(A)−ρ(B) in M.

if u=v and z=h, then W_(ρ(B)) is not a valid walk in M.

if u=v and z=v and j_(B)=2, then W_(ρ(B)) IS a valid walk in M. And κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B)

if u=v and z=v and j_(B)>2, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B) in M

4. Case: Row(B)=1 and Col(B)>1

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}.

${B = \left( {i_{B},j_{B}} \right)}{{W_{\rho(B)} = \left( {\left( {i_{0},j_{0}} \right),\left( {i_{1},j_{1}} \right),\ldots,{\left( {i_{s},j_{s}} \right) = B}} \right)},{s > 0.}}{W = {W_{\rho(B)}\left( \left( {i_{A},j_{A}} \right) \right)}}{{{\rho(A)} \geq {\overset{\_}{S}}_{W}} = {{{\overset{\_}{S}}_{W{\rho(B)}} + {{\hat{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},{\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}} = {{{\overset{\_}{S}}_{W{\rho(B)}} + h_{u}} = {{\rho(B)} + h_{u}}}}}{h_{u} \leq {{\rho(A)} - {\rho(B)}}}$

For x∈{d, h, v}, if (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(X), then u=x.

OK for AS

For M:

For u=d, both W_(ρ(B)) and W are valid walks in M.

For u=h, W_(ρ(B)) may be a valid walk in M. And W is a valid walk in M.

For u=v, W_(ρ(B)) IS a valid walk in M. ρ(B)=v ρ(A)≥κ(x _(i) _(A) ,y _(j) _(A) ) κ(x _(i) _(A) ,y _(j) _(A) )−v≤ρ(A)−ρ(B)

Thus, we are done with M.

5. Case: Row(B)>1 and Col(B)=1

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}.

${B = \left( {i_{B},j_{B}} \right)}{{W_{\rho(B)} = \left( {\left( {i_{0},j_{0}} \right),\left( {i_{1},j_{1}} \right),\ldots,{\left( {i_{s},j_{s}} \right) = B}} \right)},{s > 0.}}{W = {W_{\rho(B)}\left( \left( {i_{A},j_{A}} \right) \right)}}{{{\rho(A)} \geq {\overset{\_}{S}}_{W}} = {{{\overset{\_}{S}}_{W{\rho(B)}} + {{\hat{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},{\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}} = {{{\overset{\_}{S}}_{W{\rho(B)}} + h_{u}} = {{\rho(B)} + h_{u}}}}}{h_{u} \leq {{\rho(A)} - {\rho(B)}}}$

For x∈{d, h, v}, if (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(x), then u=x.

OK for AS

For M:

For u=d, both W_(ρ(B)) and W are valid walks in M.

For u=h, W_(ρ(B)) IS a valid walk in M. So is and W.

For u=v, W_(ρ(B)) may be a valid walk in M, but W is not a valid walk in M.

Thus, we need to find a valid W.

OK for M except u=v=>h_(v)=>W not a valid walk for ρ(A) in M

Below is in M space:

${{{{\overset{'}{W}}_{\rho{(B)}}\left( \left( {i_{l},j_{l}} \right) \right)}\overset{\Delta}{=}\left( {{\left( {0,0} \right) = \left( {i_{0},j_{0}} \right)},\left( {i_{1},j_{1}} \right),\ldots,\left( {i_{l},j_{l}} \right)} \right)},{{{{for}0} \leq l \leq {s.W_{\rho(B)}}} = {{{\overset{'}{W}}_{\rho{(B)}}\left( \left( {i_{s - 1},j_{s - 1}} \right) \right)}\left( \left( {i_{s},j_{s}} \right) \right)}}}{W = {{{\overset{'}{W}}_{\rho{(B)}}\left( \left( {i_{s - 1},j_{s - 1}} \right) \right)}\left( \left( {i_{A},j_{A}} \right) \right)}}{{{\rho(A)} \geq {\overset{\_}{S}}_{W}} = {{{\overset{\_}{S}}_{\overset{'}{W}{\rho(B)}^{({({i_{s - 1},j_{s - 1}})})}} + {{\hat{\varphi}}_{1}\left( {\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{A},j_{A}} \right)} \right)}} = {{\overset{\_}{S}}_{\overset{'}{W}{\rho(B)}^{({({i_{s - 1},j_{s - 1}})})}} + {\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)}}}}{{\rho(B)} = {{\overset{\_}{S}}_{W{\rho(B)}} = {{\overset{\_}{S}}_{\overset{'}{W}{\rho(B)}^{({({i_{s - 1},j_{s - 1}})})}} + {{\hat{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}}}{{{{\rho(A)} - {\rho(B)}} \geq {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - {{\hat{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}} = {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - v_{z}}}{{{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - v_{z}} \leq {{\rho(A)} - {\rho(B)}}}{{{{if}u} = {{v{and}z} = d}},{{{{then}{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)}} - v_{d}} \leq {{\rho(A)} - {{\rho(B)}{in}M}}}}$

if u=v and z=h, then W_(ρ(B)) is not a valid walk in M.

if u=v and z=v and j_(B)=2, then W_(ρ(B)) IS a valid walk in M. So is and W.

And κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B).

if u=v and z=v and j_(B)>2, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B) in M

6. Case: Row(B)=1 and Col(B)=1

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}.

${B = \left( {i_{B},j_{B}} \right)}{{W_{\rho(B)} = \left( {\left( {i_{0},j_{0}} \right),\left( {i_{1},j_{1}} \right),\ldots,{\left( {i_{s},j_{s}} \right) = B}} \right)},{s > 0.}}{W = {W_{\rho(B)}\left( \left( {i_{A},j_{A}} \right) \right)}}{{{\rho(A)} \geq {\overset{\_}{S}}_{W}} = {{{\overset{\_}{S}}_{W{\rho(B)}} + {{\hat{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},{\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}} = {{{\overset{\_}{S}}_{W{\rho(B)}} + h_{u}} = {{\rho(B)} + h_{u}}}}}{h_{u} \leq {{\rho(A)} - {\rho(B)}}}$

For x∈{d, h, v}, if (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(x), then u=x.

OK for AS

For M:

u=h=>W_(ρ(B)) IS a valid walk in M. So is W.

For u=d, both W_(ρ(B)) and W are valid walks in M. Thus, we are done for M.

For u=v=>W_(ρ(B)) IS a valid walk in M. But W is not and we need a new W. We pick the one reaching A diagonally.

Thus, κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B).

Therefore, overall, for AS, min {0, h, h_(d), h_(h), h_(v)}≤ρ(A)−ρ(B) −α−β≤ρ(A)−ρ(B)

Overall, for M, min{−α−β, κ_(min)+β}≤ρ(A)−ρ(B).

A. Lemma 1.2—Upper Bound

Given vertices B=(i,j) and A=(i+1,j), we have

ρ(A)−ρ(B)≤κ_(max)+α+β, for affine and affine simplified gap score, and

ρ(A)−ρ(B)≤κ_(max)−κ_(min), for modified gap score.

Proof: Briefly, for every possible walk for ρ(A), we find a walk W(B) of B such that ρ(A)−Score of (W(B))≤upper bound.

Step 1) All possible walks for ρ(A):

This section characterized all possible walks for ρ(A), and their corresponding W(B)

In order to find an upper bound to ρ(A)−ρ(B), following cases are considered.

Notations:

row=row of the dark circle in digraph D(x,y).

col=column of the dark circle on digraph D.

ticker lines are possible walks of ρ(A).

thinner lines are possible arcs leading to B.

D, H and V mark a diagonal, horizontal and vertical arc, respectively.

dashed thick lines are invalid for ρ(A) for modified gap score.

dashed thin lines are invalid for certain walks to B for modified gap score.

1. Case 1: Row>1 and Col=2

FIG. 18 shows a table 1800 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Table 1800 has 4 rows and 6 columns. Note the rows and columns of Table 1800 are different from the row and columns on Digraph D. With reference to FIG. 18 , both walks are valid with respect to overlapping alignment with the specific affine gap function.

The second row and fifth column of Table 1800 show portions of three possible walks for ρ(A) for AS. The first portion has the arc H ending on vertex O, followed by a diagonal edge, followed by r (r>=0) vertical arc(s) ending on A. Let's use, P, to denote the walk from the dark circle to A. Let's denote this walk by HP. The second portion has the arc D ending on vertex O, followed by P. Let's denote this walk by DP. The third portion has the arc V ending on vertex O, followed by P. Let's denote this walk by VP. The second row and fifth column of Table 1800 also shows portions of three possible walks ending on B for AS. The first portion has the arc H ending on vertex O, followed by one or more vertical arcs ending on B.

Let's use, Q, to denote the vertical walk from the dark circle to B. Let's denote the first walk by HQ. The second portion has the arc D ending on vertex O, followed by Q. Let's denote this walk by HQ. The third portion has the arc V ending on vertex O, followed by Q. Let's denote this walk by VP. If ρ(A) contains HP, then we will use HQ to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains DP, then we will use DQ to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains VP, then we will use VQ to obtain an upper bound for ρ(A)−ρ(B).

It should be noted that the fourth and sixth columns of the table are for cases when the dark circle is on vertex (0,0). These cases are not valid for row>1 and col=2.

The third row and fifth column of Table 1800 shows additional portions of three possible walks for ρ(A) for AS.

The first portion has the arc H ending on vertex O, followed by a horizontal edge, followed by r (r>=1) vertical arc(s) ending on A. Let's use, U, to denote the walk from the dark circle to A. Let's denote this walk by HU. The second portion has the arc D ending on vertex O, followed by U. Let's denote this walk by DU. The third portion has the arc V ending on vertex O, followed by U. Let's denote this walk by VU. The third row and fifth column of Table 1800 also shows portions of three possible walks ending on B for AS. The first portion has the arc H ending on vertex O, followed by one or more vertical arcs ending on B.

Let's use, W, to denote the vertical walk from the dark circle to B. Let's denote the first walk by HW. The second portion has the arc D ending on vertex O, followed by W. Let's denote this walk by HW. The third portion has the arc V ending on vertex O, followed by W. Let's denote this walk by VW.

If ρ(A) contains HU, then we will use HW to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains DU, then we will use DW to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains VU, then we will use VW to obtain an upper bound for ρ(A)−ρ(B).

The fourth row and fifth column of Table 1800 shows yet more portions of three possible walks for ρ(A) for AS. The first portion has the arc H ending on vertex O, followed by a horizontal arc to A. Let's use, X, to denote the arc from the dark circle to A. Let's denote this walk by HX. The second portion has the arc D ending on vertex O, followed by X. Let's denote this walk by DX. The third portion has the arc V ending on vertex O, followed by X. Let's denote this walk by VX. The fourth row and fifth column of Table 1800 also shows portions of three possible walks for ρ(A) for AS.

The first portion has the arc H ending on vertex O, but vertex O and vertex B are the same here. Let's call this walk H. The second portion has the arc D ending on vertex B (O). Let's denote this walk by D. The third portion has the arc V ending on vertex B. Let's denote this walk by V.

If ρ(A) contains HX, then we will use H to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains DX, then we will use D to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains VX, then we will use V to obtain an upper bound for ρ(A)−ρ(B). The second row and third column of Table 1800 shows the walks HP, DP and VP of ρ(A) for M.

Here, HQ is not a valid walk to reach B since no right angles are allowed. Therefore, for H, we need to find another walk for B, which is valid in M. To this end, the arc H is extended backwards by arcs H1, D1, and V1. Now, H1 is not valid for ρ(A) since col=2 and it would generate a 90 degree turn from the col=0. Also, V1 is not valid for ρ(A) since it is perpendicular to H. But D1 is a valid extension. We demote a walk for ρ(A) that uses H by D1HP, and a walk for B corresponding to D1HP by D1D0Q′, where Q′ is the walk from the empty circle square to B. If ρ(A) contains D1HP in M, then we will use D1D0Q′ to obtain an upper bound for ρ(A)−ρ(B).

The third row and third column of Table 1800 shows the walks HU, DU and VU of ρ(A) for M. Here, U is not a valid walk for ρ(A) for M since it has a right angle turn. Therefore, there are no walks of the type described in this the third row and third column of Table 1800 for ρ(A) for M. The fourth row and third column of Table 1800 also shows portions of three possible walks for ρ(A) for M: HX, DX, and HX. VX is not valid for M because of its right angle. Therefore,

If ρ(A) contains HX, then we will use H to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains DX, then we will use D to obtain an upper bound for ρ(A)−ρ(B).

The following cases 2-10, are derived as case 1.

2. Case 2: Row>1 and Col>2

FIG. 19 shows a table 1900 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

3. Case 3: Row=1 and Col=2

FIG. 20 shows a table 2000 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

4. Case 4: Row=1 and Col>2

FIG. 21 shows a table 2100 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

5. Case 5: Row>1 and Col=1

FIG. 22 shows a table 2200 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

6. Case 6: Row=1 and Col=1

FIG. 23 shows a table 2300 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

7. Case 7: Row>0 and Col=0

FIG. 24 shows a table 2400 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

8. Case 8: Row=1 and Col>1

FIG. 25 shows a table 2500 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

9. Case 9: Row=0 and Col=1

FIG. 26 shows a table 2600 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function.

10. Case 10: Row=0 and Col=0

FIG. 27 shows a table 2700 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to overlapping alignment with the specific affine gap function. With reference to FIG. 27 , since the dark circle is on vertex (0,0), column 3 and column 5 cases are not valid since all their H, D, and V arcs are invalid. However, column 6 cases are valid, and two of the three cases of the fourth column are valid. For the second row, third and sixth column of Table 2700: FP denotes the ρ(A) walk. And FQ denotes the walk to B. F denotes no tail. For the third row, sixth column: FU denotes the ρ(A) walk. And FW denotes the walk to B. For the fourth row, third and sixth column: FX denotes the ρ(A) walk. And F denotes the walk to B.

Step 2) Tabulation of all possible walks for ρ(A), and their corresponding W(B).

Tables below describes all possible walks for ρ(A), and their corresponding W(B) for AS and M.

AS:

D=diagonal tail, H=horizontal tail, V=vertical tail, and F=no tail.

Based on the tables on pairs of walks on digraph D(x, y), table below gives pairs of walks that are valid for AS. The pairs in bold are not valid.

01 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX DW HW VW XX D H V F C = 2 02 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX DW HW VW XX D H V F C > 2 03 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX DW HW VW XX D H V F C = 2 04 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX DW HW VW XX D H V F C > 2 05 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX DW HW VW XX D H V F C = 1 06 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX DW HW VW XX D H V F C = 1 07 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 0 DQ HQ VQ XX DW HW VW XX D H V F C = 0 08 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ XX DW HW VW XX D H V F C > 1 09 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ XX DW HW VW XX D H V F C = 1 10 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ FQ DW HW VW FW D H V F C = 0

M:

Based on the tables on pairs of walks on digraph D(x, y), table below gives pairs of walks that are valid for M. The pairs in bold are not valid.

01 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX XX XX XX XX D H V F C = 2 DHP DDQ′ HHP HDQ′ VHP XXX 02 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX XX XX XX XX D H V F C > 2 DHP DDQ′ HHP HDQ′ VHP XXX 03 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX XX XX XX XX D H V F C = 2 DHP DDQ′ HHP HDQ′ VHP XXX 04 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX XX XX XX XX D H V F C > 2 DHP DDQ′ HHP HDQ′ VHP XXX 05 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX XX XX XX XX D H V F C = 1 HP DQ′ 06 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX XX XX XX XX D H V F C = 1 HP DQ′ 07 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 0 DQ HQ VQ XX XX XX XX XX D H V F C = 0 08 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ XX XX XX XX XX D H V F C > 1 DHP DDQ′ HHP HDQ′ VHP XXX 09 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ XX XX XX XX XX D H V F C = 1 DHP DDQ′ HHP HDQ′ VHP XXX FHP FDQ′ 10 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ FQ XX XX XX XX D H V F C = 0

Step 3) The scores of all possible walks for ρ(A), and their corresponding W(B).

This step we calculate the score of all the walk in the tables of step 2).

We start with the following definitions.

Definitions: For A=(i_(A),j_(A)) and W_(ρ(A))=((i₀,j₀), (i₁,j₁), . . . , (i_(t),j_(t))=A), t>0. {acute over (W)} _(ρ(A))((i _(l) ,j _(l)))

((i ₀ ,j ₀)(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l))) 0≤l≤t {acute over (W)} _(ρ(A))((i _(l) ,j _(l)))

((i _(l) ,j _(l)),(i _(l+1) ,j _(l+1)), . . . ,(i _(t) ,j _(t))=A) 0≤l≤t P ^(|)((i,j);r)

((i,j+1),(i,j+2), . . . (i,j+r)) i,j, and r≥0 P ^(|)((i,j);0)

(ϕ) P ^(d|)((i,j);r)

((i,j),(i+1,j+1))P ^(|)((i+1,j+1);r) i,j, and r≥0 P ^(h|)((i,j);r)

((i,j),(i+1,j))P ^(|)((i+1,j);r) i,j, and r≥0 P ^(f)((i,j))

((i,j),(i+1,j)) i,j≥0 P ^(v|)((i,j);r)

((i,j))P ^(|)((i,j);r) i,j, and r≥0 ρ((0,0))

0

We use W₁W₂ and W₁★W₂ to represent the concatenation of the sequences (or walks) W₁ and W₂.

Lemma T. Given two walks W₁ and W₂, W ₁=((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(k−1) ,j _(k−1)),(i _(k) ,j _(k))(i _(k+1) ,j _(k+1)),(i _(k+2) ,j _(k+2)), . . . ,(i _(p) ,j _(p))) W ₂=((i′ ₀ ,j′ ₀),(i′ ₁ ,j′ ₁), . . . ,(i′ _(k−1) ,j′ _(k−1)),(i′ _(k) ,j′ _(k))(i′ _(k+1) ,j′ _(k+1)),(i′ _(k+2) ,j′ _(k+2)), . . . ,(i′ _(p) ,j′ _(p)))

that agree in vertices: (i_(m),j_(m))=(i′_(m),j′_(m)), m≤k, we have S _(W) ₁ −S _(W) ₂ =Σ_(q=k) ^(p)(({circumflex over (φ)}₁((i _(q−1) ,j _(q−1))(i _(q) ,j _(q)),(i _(q) ,j _(q))(i _(q+1) ,j _(q+1)))−{circumflex over (φ)}₁((i _(q−1) ,j _(q−1))(i′ _(q) ,j′ _(q)),(i′ _(q) ,j′ _(q))(i′ _(q+1) ,j′ _(q+1))))

The following correspondence is used.

(a) DP (b) HD (c) VD (d) FD (e) DU (f) HU (g) VH (h) FU (i) DX (j) HX (k) VX (l) FX (m) FY (n) DP (o) HD (p) VD (q) FD (n) DU (o) HU (p) VH (q) FU (r) DX (s) HX (t) VX (u) FX (v) DHP (w) HHD (x) VHD (y) FHD A DDQ′ B HDQ′ C VDQ′ D FDQ′

More notions are defined to identify the walks of interest.

For AS:

For r≥0, T _(d) P ^(d|)((i,j);r)

((i−1,j−1))P ^(d|)((i,j);r)  (α) T _(h) P ^(d|)((i,j);r)

((i−1,j))P ^(d|)((i,j);r)  (b) T _(v) P ^(d|)((i,j);r)

((i,j−1))P ^(d|)((i,j);r)  (c) T _(ϕ) P ^(d|)((i,j);r)

(ϕ)P ^(d|)((i,j);r)  (d)

For s>0, T _(d) P ^(d|)((i,j);s)

((i−1,j−1))P ^(h|)((i,j);s)  (e) T _(h) P ^(d|)((i,j);s)

((i−1,j))P ^(h|)((i,j);s)  (f) T _(v) P ^(d|)((i,j);s)

((i,j−1))P ^(h|)((i,j);s)  (g) T _(ϕ) P ^(d|)((i,j);s)

(ϕ)P ^(h|)((i,j);s)  (h) T _(d) P ^(f)(i,j)

T _(d)((i,j)(i+1,j))  (i) T _(h) P ^(f)(i,j)

T _(h)((i,j)(i+1,j))  (j) T _(v) P ^(f)(i,j)

T _(v)((i,j)(i+1,j))  (k) T _(ϕ) P ^(f)(i,j)

_(v)((i,j)(i+1,j))  (l)

For s=1, T _(ϕ) P ^(v|)((i,j);r)

(ϕ)((i,j))P ^(|)((i,j);s)  (m)

For s>0, T _(d) P ^(v|)((i,j);s)

T _(d)((i,j))P ^(|)((i,j);s)  (n) T _(h) P ^(v|)((i,j);s)

T _(h)((i,j))P ^(|)((i,j);s)  (o) T _(v) P ^(v|)((i,j);s)

T _(v)((i,j))P ^(|)((i,j);s)  (p) T _(ϕ) P ^(v|)((i,j);s)

T _(ϕ)((i,j))P ^(|)((i,j);s)  (q) T _(d)((i,j))  (r) T _(h)((i,j))  (s) T _(v)((i,j))  (t) T _(ϕ)((i,j))  (u)

For M:

For r≥0, T _(d) T _(d) P ^(v|)((i,j+1);r)

T _(d) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (A) T _(h) T _(d) P ^(v|)((i,j+1);r)

T _(h) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (B) T _(v) T _(d) P ^(v|)((i,j+1);r)

T _(v) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (C) T _(ϕ) T _(d) P ^(v|)((i,j+1);r)

T _(ϕ) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (D)

Below we compute the score of the walks characterized above:

11. Case: i>1, j>1; (a)(b)(c)(d); r≥0

${{T_{d}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{\left( \left( {{i - 1},{j - 1}} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}} = {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)\begin{pmatrix} {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}}}}}{{\overset{\_}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}}{{\overset{\_}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ {{\begin{matrix} {{0r} = 0} \\ {{v_{d} + {\left( {r - 1} \right)v_{v}r}} \geq 1} \end{matrix}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}} = {{\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)\begin{pmatrix} {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}{\overset{\_}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}}} = {{{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}{\overset{\_}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}}}}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ {{\begin{matrix} {{0r} = 0} \\ {{v_{d} + {\left( {r - 1} \right)v_{v}r}} \geq 1} \end{matrix}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}} = {{\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)\begin{pmatrix} {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}{\overset{\_}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}}} = {{{{\hat{\varphi}}_{0}\left( {\left( {i,{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}{\overset{\_}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}}}}} = {v + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ {{\begin{matrix} {{0r} = 0} \\ {{v_{d} + {\left( {r - 1} \right)v_{v}r}} \geq 1} \end{matrix}T_{\phi}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{(\phi){P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {{\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}} = {{\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)\left( {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),{\ldots\left( {{i + 1},{j + 1 + r}} \right)}} \right){\overset{\_}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}}} = {{{{\hat{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}{\overset{\_}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}}}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} {{0{if}r} = 0} \\ {{v_{d} + {\left( {r - 1} \right)v_{v}{if}r}} \geq 1} \end{matrix} \right.}}}}}} \right.}}}}}} \right.}}}}}} \right.}}$

12. Case: i>1, j>1; (e)(f)(g)(h); s>0

$\left. {{{T_{d}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{\left( \left( {{i - 1},{j - 1}} \right) \right){P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){P^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}} = {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)\left( {{i + 1},{j + 1}} \right)}}}},\left( {{i + 1},{j + 2}} \right),{\ldots\left( {{i + 1},{j + s}} \right)}} \right){{\overset{\_}{S}}_{T_{d}{P^{h❘}({{({i,j})};s})}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}}{{\overset{\_}{S}}_{T_{d}{P^{h❘}({{({i,j})};s})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + h_{d} + \left\{ \begin{matrix} {{0{if}s} = 0} \\ {{v_{h} + {\left( {s - 1} \right)v_{v}{if}s}} \geq 1} \end{matrix} \right.}}$

s=0 not valid since we assumed it is greater than 0.

$\left. {{{T_{h}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{\left( \left( {{i - 1},j} \right) \right){P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){P^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}} = {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)\left( {{i + 1},{j + 1}} \right)}}}},\left( {{i + 1},{j + 2}} \right),{\ldots\left( {{i + 1},{j + s}} \right)}} \right){{\overset{\_}{S}}_{T_{h}{P^{h❘}({{({i,j})};s})}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right) + \left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}}{{\overset{\_}{S}}_{T_{h}{P^{h❘}({{({i,j})};s})}} = {h + h_{h} + \left\{ \begin{matrix} {{0{if}s} = 0} \\ {{v_{h} + {\left( {s - 1} \right)v_{v}{if}s}} \geq 1} \end{matrix} \right.}}$

s=0 not valid since we assumed it is greater than 0.

${{T_{v}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{\left( \left( {i,{j - 1}} \right) \right){P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{\left( \left( {i,{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){P^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}} = {\left( \left( {i,{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)\left( {\left( {{i + 1},{j + 1}} \right),\left( {{i + 1},{j + 2}} \right),{\ldots\left( {{i + 1},{j + s}} \right)}} \right)}}}}{{\overset{\_}{S}}_{T_{v}{P^{h❘}({{({i,j})};s})}} = {{{\hat{\varphi}}_{0}\left( {\left( {i,{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}}{{\overset{\_}{S}}_{T_{v}{P^{h❘}({{({i,j})};s})}} = {v + h_{v} + \left\{ \begin{matrix} {{0{if}s} = 0} \\ {{v_{h} + {\left( {s - 1} \right)v_{v}{if}s}} \geq 1} \end{matrix} \right.}}$

s=0 not valid since we assumed it is greater than 0.

${{T_{\phi}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{(\phi){P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {{\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){P^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}} = {\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)\left( {\left( {{i + 1},{j + 1}} \right),\left( {{i + 1},{j + 2}} \right),{\ldots\left( {{i + 1},{j + 2}} \right)}} \right)}}}}{{\overset{\_}{S}}_{T_{\phi}{P^{h❘}({{({i,j})};s})}} = {{{\hat{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}}{{\overset{\_}{S}}_{T_{\phi}{P^{h❘}({{({i,j})};s})}} = {h + \left\{ \begin{matrix} {{0{if}s} = 0} \\ {{v_{h} + {\left( {s - 1} \right)v_{v}{if}s}} \geq 1} \end{matrix} \right.}}$

s=0 not valid since we assumed it is greater than 0.

13. Case: i>1, j>1; (i)(j)(k)(l); No r in this Case.

${{{P^{f}\left( \left( {i,j} \right) \right)}\overset{\Delta}{=}\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)},{{for}{integers}},{i \geq {0{and}j} \geq 0}}{{T_{d}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{d}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}{{T_{d}{P^{f}\left( \left( {i,j} \right) \right)}} = {{T_{d}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} = {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}}{{\overset{\_}{S}}_{T_{d}{P^{f}({({i,j})}}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)}}}{{\overset{\_}{S}}_{T_{d}{P^{f}({({i,j})}}} = {{\kappa\left( {x_{i},y_{j}} \right)} + h_{d}}}{{T_{h}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{h}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}{{T_{h}{P^{f}\left( \left( {i,j} \right) \right)}} = {{T_{h}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} = {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}}{{\overset{\_}{S}}_{T_{h}{P^{f}({({i,j})}}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)}}}{{\overset{\_}{S}}_{T_{h}{P^{f}({({i,j})}}} = {h + h_{h}}}{{T_{v}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{v}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}{{T_{v}{P^{f}\left( \left( {i,j} \right) \right)}} = {{T_{v}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} = {\left( \left( {i,{j - 1}} \right) \right)\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}}{{\overset{\_}{S}}_{T_{v}{P^{f}({({i,j})}}} = {{{\hat{\varphi}}_{0}\left( {\left( {i,{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)}}}{{\overset{\_}{S}}_{T_{v}{P^{f}({({i,j})}}} = {v + h_{v}}}{{T_{\phi}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{\phi}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}{{T_{\phi}{P^{f}\left( \left( {i,j} \right) \right)}} = {{T_{\phi}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} = {{(\phi)\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} = \left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}}{{\overset{\_}{S}}_{T_{\phi}{P^{f}({({i,j})}}} = {{\hat{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}}{{\overset{\_}{S}}_{T_{\phi}{P^{f}({({i,j})}}} = h}$

14. Case: i>1, j>1; (m); r≥1

This is not a valid case for global alignment.

15. Case: i>1, j>1; (n)(o)(p)(q); s≥1

${T_{d}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{{T_{d}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{d}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {{T_{d}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {i,{j + 2}} \right),{\ldots\left( {i,{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},\ {\left( {i,j} \right)\left( {i,{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};s})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ ${T_{h}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{{T_{h}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{h}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {{T_{h}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {i,{j + 2}} \right),{\ldots\ \left( {i,{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {i,{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};s})}} = {h + v_{h} + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ ${T_{v}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{{T_{v}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{v}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {{T_{v}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {i,{j - 1}} \right) \right)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {i,{j - 1}} \right) \right)\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {i,{j + 2}} \right),\ {\ldots\left( {i,{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {i,{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};s})}} = {v + v_{v} + {\left( {s - 1} \right)v_{v}}}},{{{for}s} \geq 1.}$ ${T_{\phi}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{(\phi)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ ${P^{v❘}\left( {\left( {i,j} \right);s} \right)}\overset{\Delta}{=}{\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{\phi}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {{T_{\phi}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {(\phi)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {i,{j + 2}} \right),\ {\ldots\left( {i,{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {i,{j + 1}} \right)} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};s})}} = {v + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq {1.}}$

16. Case: i>1, j>1; (r)(s)(t)(u) T _(d)((i,j))  (r) T _(h)((i,j))  (s) T _(v)((i,j))  (t) T _(ϕ)((i,j))  (u) S _(T) _(d) _(((i,j)))=κ(x _(i) ,y _(j)) S _(T) _(h) _(((i,j))) =h S _(T) _(v) _(((i,j))) =v S _(T) _(ϕ) _(((i,j)))

0 (This does notoccur in global alignment.)

17. Case: i>1, j>1; (v)(w)(x)(y); r≥0

$\begin{matrix} {{T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (v) \end{matrix}$ $\begin{matrix} {{T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (w) \end{matrix}$ $\begin{matrix} {{T_{v}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (x) \end{matrix}$ $\begin{matrix} {{T_{\phi}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{(\phi)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (y) \end{matrix}$ ${T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}$ $\begin{matrix} {{T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),{\left( {{i + 1},{j + 1}} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}}} \right.}} \\ {{= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} \left( {{i + 1},{j + 1 + 1}} \right) \\ {,{\ldots\left( {{i + 1},{j + 1 + r}} \right)}} \end{pmatrix}} \end{matrix}$ ${\overset{¯}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)},\ {\left( {{i - 1},j} \right)\left( {i,j} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},\ {\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},\ {\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + h_{d} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}$ $\begin{matrix} {{T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)P^{❘}}}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)} \\ {{= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} \left( {\left( {{i + 1},{j + 2}} \right),\left( {{i + 1},{j + 3}} \right)} \right. \\ {,{\ldots\left( {{i + 1},{j + 1 + r}} \right)}} \end{pmatrix}} \end{matrix}$ ${\overset{¯}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)},{\left( {{i - 1},j} \right)\left( {i,j} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},\ {\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + h_{h} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${T_{v}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}$ $\begin{matrix} {{T_{v}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)P^{❘}}}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)} \\ {{= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} \left( {\left( {{i + 1},{j + 2}} \right),\left( {{i + 1},{j + 3}} \right)} \right. \\ {,{\ldots\left( {{i + 1},{j + 1 + r}} \right)}} \end{pmatrix}} \end{matrix}$ ${\overset{¯}{S}}_{T_{v}T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {{i - 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {{i - 1},j} \right)},{\left( {{i - 1},j} \right)\left( {i,j} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{v}T_{h}{P^{d❘}({{({i,j})};r})}} = {v + h_{v} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

Not valid in all cases; right angle.

$\begin{matrix} {{T_{\phi}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {(\phi)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{¯}{S}}_{T_{\phi}T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{\phi}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

Not valid in all locations for global alignment.

18. Case: i>1, j>1; A, B, C, and d; r≥0

$\begin{matrix} {{T_{d}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{d}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (A) \end{matrix}$ $\begin{matrix} {{T_{h}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{h}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (B) \end{matrix}$ $\begin{matrix} {{T_{v}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{v}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (C) \end{matrix}$ $\begin{matrix} {{T_{\phi}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{\phi}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (D) \end{matrix}$ T_(d)T_(d)P^(v❘)((i, j + 1); r) = ((i − 2, j − 1))((i − 1, j))((i, j + 1))P^(❘)((i, j + 1); r) $\begin{matrix} {{T_{d}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}} = {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right){P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right)\left( \left( {i,{j + 1 + 1}} \right) \right)}}\begin{pmatrix} {\left( {i,{j + 1 + 2}} \right),} \\ {\ldots\left( {i,{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{¯}{S}}_{T_{d}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)},{\left( {i - j} \right)\left( {i,{j + 1}} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)},{\left( {i,{j + 1}} \right)\left( {i,{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( \left( {i,{j + 1 + q - \left( {i,{j + 1 + q - 1}} \right)},{\left( {i,{j + 1 + q - 1}} \right)\left( {i,{j + 1 + q}} \right)}} \right) \right.}}}$ ${\overset{¯}{S}}_{T_{d}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}r} \geq 1} \end{matrix} \right.}$ T_(h)T_(d)P^(v❘)((i, j + 1); r) = ((i − 2, j))((i − 1, j))((i, j + 1))P^(❘)((i, j + 1); r) $\begin{matrix} {{T_{h}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}} = {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right){P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right)\left( \left( {i,{j + 1 + 1}} \right) \right)}}\left( {\left( {i,{j + 1 + 2}} \right),{\ldots\left( {i,{j + 1 + r}} \right)}} \right)} \end{matrix}$ ${\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)},{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)},{\left( {i,{j + 1}} \right)\left( {i,{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + 1 + q - 2}} \right)\left( {i,{j + 1 + q - 1}} \right)},{\left( {i,{j + 1 + q - 1}} \right)\left( {i,{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {h + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}r} \geq 1} \end{matrix} \right.}$ T_(v)T_(d)P^(v❘)((i, j + 1); r) = T_(v)T_(d)((i, j + 1))P^(❘)((i, j + 1); r)

Not valid in M; produces a right angle.

${T_{\phi}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{\phi}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}$ T_(ϕ)T_(d)P^(v❘)((i, j + 1); r) = (ϕ)((i − 1, j))((i, j + 1))P^(❘)((i, j + 1); r) $\begin{matrix} {{T_{\phi}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}} = {\left( \left( {{i - 1},j} \right) \right){P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right){P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right)\left( \left( {i,{j + 1 + 1}} \right) \right)\left( {\left( {i,{j + 1 + 2}} \right),\ {\ldots\left( {i,{j + 1 + r}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)},{\left( {i,{j + 1}} \right)\left( {i,{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + 1 + q - 2}} \right)\left( {i,{j + 1 + q - 1}} \right)},{\left( {i,{j + 1 + q - 1}} \right)\left( {i,{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$

Step 4) [ρ(A)−Score of W(B)] of all possible walks for ρ(A), and their corresponding W(B).

Difference of score of pairs of pairs: (DP,DQ), (HP,HQ), (VP,VQ), and (FP,FQ)

equivalently pairs: (α)(n), (b)(o), (c)(p), and (d)(q)

for i>1, j>1; r≥0.

${\overset{¯}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};s})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ s = r + 1. ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}{}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {rv_{v}}}},{{{for}{}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{d}}},{{{if}r} = 0}$ ${{{\overset{¯}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{v}}},{{{if}{}r} \geq 1}$ ${\overset{¯}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};s})}} = {h + v_{h} + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ s = r + 1 ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}} = {h + v_{h} + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}{}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}} = {h + v_{h} + {rv_{v}}}},{{{for}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{h}}},{{{if}r} = 0}$ ${{{\overset{¯}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + v_{d} - v_{h} - v_{v}}},{{{if}r} \geq 1}$ ${\overset{¯}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} = {v + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};s})}} = {v + v_{v} + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ s = r + 1 ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}} = {v + v_{v} + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}} = {v + v_{v} + {rv_{v}}}},{{{for}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{v}}},{{{if}{}r} = 0}$ ${{{\overset{¯}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + v_{d} - v_{v} - v_{v}}},{{{if}r} \geq 1}$ ${\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};s})}} = {v + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ s = r + 1 ${{\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};{r + 1}})}} = {v + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}{}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} = {v + {rv_{v}}}},{}{{{for}{}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v}},{{{if}{}r} = 0}$ ${{{\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + v_{d} - v - v_{v}}},{{{if}r} \geq 1}$

Difference of score of pairs of pairs: (DU,DW), (HU,HW), (VU,VW), and (FU,FW)

equivalently pairs: (e)(n), (f)(o), (g)(p), and (h)(q)

fori > 1, j > 1; r ≥ 0. ${\overset{¯}{S}}_{T_{d}{P^{h❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + h_{d} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$

r=0 is not valid since r assumed is to be greater than 0.

${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {r - 1} \right)v_{v}}}},{{{if}{}r} \geq 1.}$ ${{{\overset{¯}{S}}_{T_{d}{P^{h❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};r})}}} = {h_{d} + v_{h} - v_{d}}},{{{if}r} \geq 1.}$ ${\overset{¯}{S}}_{T_{h}{P^{h❘}({{({i,j})};r})}} = {h + h_{h} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$

r=0 is not valid since r assumed is to be greater than 0.

${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};r})}} = {h + v_{h} + {\left( {r - 1} \right)v_{v}}}},{{{if}{}r} \geq 1.}$ ${{{\overset{¯}{S}}_{T_{h}{P^{h❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};r})}}} = h_{h}},{{{if}r} \geq 1.}$ ${\overset{¯}{S}}_{T_{v}{P^{h❘}({{({i,j})};r})}} = {v + h_{v} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$

r=0 is not valid since r assumed is to be greater than 0.

${{\overset{\_}{S}}_{T_{v}{P^{v|}({{({i,j})};r})}} = {v + v_{v} + {\left( {r - 1} \right)v_{v}}}},{{{if}r} \geq 1.}$ ${{\overset{\_}{S}}_{T_{v}{P^{h❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};r})}}} = {h_{v} + v_{h} - v_{v}}$ ${\overset{¯}{S}}_{T_{\phi}{P^{h❘}({{({i,j})};r})}} = {h + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$

r=0 is not valid since r assumed is to be greater than 0

r≥1 not valid global alignment since walks start from (0,0). S _(T) _(ϕ) _(P) _(v|) _(((i,j);r)) =v+(r−1)v _(v), for r≥1. S _(T) _(ϕ) _(P) _(h|) _(((i,j);r)) −S _(T) _(ϕ) _(P) _(v|) _(((i,j);r)) =h+v _(h) −v, if r≥1

Difference of score of pairs of pairs: (DX,D), (HX,H), (VX,V), and (FX,F)

equivalently pairs: (i)(r), (j)(s), (k)(t), and (l)(u)

for i>1,j>1 S _(T) _(d) _(P) _(f) _((i,j))=κ(x _(i) ,y _(j))+h _(d) ρ(i,j)≥ S _(T) _(d) _(((i,j)))=κ(x _(i) ,y _(j)) S _(T) _(d) _(P) _(f) _((i,j))−ρ(i,j)≤κ(x _(i) ,y _(j))+h _(d)−κ(x _(i) ,y _(j))=h _(d) S _(T) _(d) _(P) _(f) _((i,j))−ρ(i,j)≤h _(d) S _(T) _(h) _(P) _(f) _((i,j)) =h+h _(h) ρ(i,j)≥ S _(T) _(h) _(((i,j))) =h S _(T) _(h) _(P) _(f) _((i,j))−ρ(i,j)h+h _(h) −h=h _(h) S _(T) _(h) _(P) _(f) _((i,j))−ρ(i,j)≤h _(h) S _(T) _(v) _(P) _(f) _((i,j)) =v+h _(v) ρ(i,j)≥ S _(T) _(v) _(((i,j))) =v S _(T) _(v) _(P) _(f) _((i,j))−ρ(i,j)≤v+h _(v) −v=h _(v) S _(T) _(v) _(P) _(f) _((i,j))−ρ(i,j)≤h _(v) S _(T) _(ϕ) _(P) _(f) _((i,j)) =h ρ(i,j)≥ S _(T) _(d) _(P) _(f) _((i,j))

S _(T) _(ϕ) _(P) _(f) _((i,j))−ρ(i,j)≤h−0 S _(T) _(ϕ) _(P) _(f) _((i,j))−ρ(i,j)≤h

Difference of score of pairs of pairs: (DHP,DDQ′), (HHP,HDQ′), (VHP,VDQ′), and (FHP,FDQ′)

equivalently pairs: (v)(A), (w)(B), (x)(C), and (y)(D)

for i>1, j>1; r≥0;

$\begin{matrix} {{T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (v) \end{matrix}$ $\begin{matrix} {{T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (w) \end{matrix}$ $\begin{matrix} {{T_{v}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (x) \end{matrix}$ $\begin{matrix} {{T_{\phi}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{(\phi)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (y) \end{matrix}$ ${\overset{¯}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + h_{d} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$ ${\overset{¯}{S}}_{T_{d}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$ ${{{\overset{¯}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}}} = {h_{d} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - {\kappa\left( {x_{i},y_{j + 1}} \right)}}},{{{for}{}r} \geq 0.}$ ${\overset{¯}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + h_{h} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$ ${\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {h + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$ ${{{\overset{¯}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}}} = {h_{h} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - {\kappa\left( {x_{i},y_{j + 1}} \right)}}},{{{for}r} \geq 0}$ ${\overset{¯}{S}}_{T_{v}T_{h}{P^{d❘}({{({i,j})};r})}} = {v + h_{v} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}\ r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}\ r} \geq 1} \end{matrix} \right.}$

Not valid in M; v followed by h!

${T_{v}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{v}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}$ ${\overset{¯}{S}}_{T_{\phi}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

Not-valid overlapping alignment.

${\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}}\overset{\Delta}{=}{{\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{{\overset{¯}{S}}_{T_{\phi}T_{h}{P^{v❘}({{({i,{j + 1}})};r})}} - {\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - {\kappa\left( {x_{i},y_{j + 1}} \right)}}},{{{for}{}r} \geq 0}$

Step 5) Tabulation of all possible ρ(A)−Score of W(B)

The above results are extended for all valid (i,j) and tabulate the results below.

For AS

R > 1 R = 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 i = R and j = C C ≥ 2 C = 2 C > 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = NO NO NO NO DQ κ(x_(i+1), y_(j+1)) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v), if r ≥ 1 2 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) = NO NO HQ κ(x_(i+1), y_(j+1)) − v_(h), if r = 0 S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(h) + v_(d) − v_(v), if r ≥ 1 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = NO NO NO VQ κ(x_(i+1), y_(j+1)) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = NO NO NO NO NO NO NO NO FQ κ(x_(i+1), y_(j+1)) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ(x_(i+1), y_(j+1)) + v_(d) − v − v_(v), if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h) NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h NO NO NO NO NO NO NO NO F

We note S _(T) _(ϕ) _((0,0))=ρ(0,1)=0.

For M

M follows AS except in row index 2. The (R,C) values that have NO in row index 2 do not have a valid walk for ρ(A), so they are ignored. But the (R,C) values that have X in row index 2 need a new walk for B since the one used for AS is not valid for M. For these (R,C)'s, we give a valid walk in the next table.

R > 1 R = 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 i = R and j = C C ≥ 2 C = 2 C > 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = NO NO NO NO DQ κ(x_(i+1), y_(j+1)) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v), if r ≥ 1 2 HP see table below X X X X X NO X X NO HQ 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) =

NO NO NO VQ κ(x_(i+1), y_(j+1)) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = NO NO NO NO NO NO NO NO FQ κ(x_(i+1), y_(j+1)) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ(x_(i+1), y_(j+1)) + v_(d) − v − v_(v), if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h)

NO NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO NO NO NO NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h NO NO NO NO NO NO NO NO F

Below, bold font pairs are not valid in M, but the regular font pairs are valid; their score differences are given in the last column. The regular font pairs use a new walks for B, which are valid in M.

01 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R > 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C = 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(h) + κ(x_(i+1), y_(j+1)) − DDQ′ κ(x_(i), y_(j+1)), for r ≥ 0. HHP HDQ′ VHP XXX 02 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R > 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(h) + κ(x_(i+1), y_(j+1)) − DDQ′ κ(x_(i), y_(j+1)), for r ≥ 0 HHP HDQ′ VHP XXX 03 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R = 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C = 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(h) + κ(x_(i+1), y_(j+1)) − DDQ′ κ(x_(i), y_(j+1)), for r ≥ 0. HHP HDQ′ VHP XXX 04 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R = 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(h) + κ(x_(i+1), y_(j+1)) − DDQ′ κ(x_(i), y_(j+1)), for r ≥ 0 HHP HDQ′ VHP XXX 05 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h + κ(x_(i+1), y_(j+1)) − R > 1 HQ κ(x_(i), y_(j+1)), if r ≥ 0 C = 1 HP DQ′ 06 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h + κ(x_(i+1), y_(j+1)) − R = 1 HQ κ(x_(i), y_(j+1)), if r ≥ 0 C = 1 HP DQ′ 07 HP HP R > 0 HQ HQ C = 0 08 HP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(h) + κ(x_(i+1), y_(j+1)) − R = 0 HQ κ(x_(i), y_(j+1)), for r ≥ 0 C > 1 DHP DDQ′ HHP HDQ′ VHP XXX 09 HP S _(T) _(ϕ) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h + κ(x_(i+1), y_(j+1)) − R = 0 HQ κ(x_(i), y_(j+1)), for r ≥ 0 C = 1 DHP DDQ′ HHP HDQ′ VHP XXX FHP FDQ′ 10 HP HP R = 0 HQ HQ C = 0

Step 6) An overall upper bound for ρ(A)−Score of W(B) for affine, simplified and modified gap scores.

Next, we maximize the upper bounds in the tables of step 5) using κ_(max), and κ_(min), where κ_(max)=max (κ(x_(i),y_(j))) and κ_(min)=min (κ(x_(i),y_(j))).

For AS:

R > 1 R = 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 i = R and j = C C ≥ 2 C = 2 C > 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO NO NO DQ κ_(max) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v), if r ≥ 1 2 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO HQ κ_(max) − v_(h), if r = 0 S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(h) + v_(d) − v_(v), if r ≥ 1 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO NO VQ κ_(max) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ NO NO NO NO NO NO NO NO FQ κ_(max) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ κ_(max) + v_(d) − v − v_(v), if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h) NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h NO NO NO NO NO NO NO NO F

For M:

R > 1 R = 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 i = R and j = C C ≥ 2 C = 2 C > 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO NO NO DQ κ_(max) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v), if r ≥ 1 2 HP see table below X X X X X NO X X NO HQ 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤

NO NO NO VQ κ_(max) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ NO NO NO NO NO NO NO NO FQ κ_(max) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ κ_(max) + v_(d) − v − v_(v), if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h)

NO NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO NO NO NO NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h NO NO NO NO NO NO NO NO F

M: continues

01 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R > 1 HQ for r ≥ 0. C = 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), DDQ′ for r ≥ 0. HHP HDQ′ VHP XXX 02 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R > 1 HQ for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), DDQ′ for r ≥ 0 HHP HDQ′ VHP XXX 03 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R = 1 HQ for r ≥ 0. C = 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + +κ_(max) − κ_(min), DDQ′ for r ≥ 0. HHP HDQ′ VHP XXX 04 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R = 1 HQ for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), DDQ′ for r ≥ 0 HHP HDQ′ VHP XXX 05 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h + κ_(max) − κ_(min), R > 1 HQ if r ≥ 0 C = 1 HP DQ′ 06 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h + κ_(max) − κ_(min), R = 1 HQ if r ≥ 0 C = 1 HP DQ′ 07 HP HP R > 0 HQ HQ C = 0 08 HP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), R = 0 HQ for r ≥ 0 C > 1 DHP DDQ′ HHP HDQ′ VHP XXX 09 HP S _(T) _(ϕ) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h + κ_(max) − κ_(min), R = 0 HQ for r ≥ 0 C = 1 DHP DDQ′ HHP HDQ′ VHP XXX FHP FDQ′ 10 HP HP R = 0 HQ HQ C = 0

Next, upper bound to ρ(A)−ρ(B) is found using the above tables, and the inequality ρ(A)−ρ(B)≤S _(T) _(d) _(P) _(d|) _(((i,j);r))−S _(T) _(d) _(P) _(v|) _(((i,j);r+1)).

For AS:

ρ(A) − ρ(B) ≤ κ_(max) − v_(d), if r = 0 ρ(A) − ρ(B) ≤ κ_(max) − v_(v), if r ≥ 1 ρ(A) − ρ(B) ≤ κ_(max) − v_(h), if r = 0 ρ(A) − ρ(B) ≤ κ_(max) − v_(h) + v_(d) − v_(v), if r ≥ 1 ρ(A) − ρ(B) ≤ κ_(max) − v_(v), if r = 0 ρ(A) − ρ(B) ≤ κ_(max) − v_(v) + v_(d) − v_(v), if r ≥ 1 ρ(A) − ρ(B) ≤ κ_(max) − v, if r = 0 ρ(A) − ρ(B) ≤ κ_(max) + v_(d) − v − v_(v), if r ≥ 1 ρ(A) − ρ(B) ≤ h_(d) + v_(h) − v_(d), if r ≥ 1. ρ(A) − ρ(B) ≤ h_(h), if r ≥ 1. ρ(A) − ρ(B) ≤ h_(v) + v_(h) − v_(v) if r ≥ 1. ρ(A) − ρ(B) ≤ h + v_(h) − v, if r ≥ 1 ρ(A) − ρ(B) ≤ h_(d) ρ(A) − ρ(B) ≤ h_(h) ρ(A) − ρ(B) ≤ h_(v) ρ(A) − ρ(B) ≤ h

Therefore, ρ(A)−ρ(B)≤max{M ₁ ,M ₂}, where M ₁=κ_(max)+max{−v _(d) ,−v _(h) ,−v _(v) ,−v,−v _(h) +v _(d) −v _(v) ,−v _(v) +v _(d) −v _(v) ,−v+v _(d) −v _(v)}, and M ₂=max{h _(d) +v _(h) −v _(d) ,h _(v) +v _(h) −v _(v) ,h+v _(h) −v,h _(d) ,h _(h) ,h _(v) ,h} M ₁=κ_(max)+max{−v _(d) ,−v _(v) +v _(d) −v _(v)}=κ_(max)+α+β M ₂=−β max{M ₁ ,M ₂}=max{κ_(max)+α+β,−β}.

Thus, ρ(A)−ρ(B)≤max {κ_(max)+α+β, −β}, for affine and simplified gap scores.

For M:

Using the two tables above for M, an upper bound for M is derived as follows.

ρ(A)−ρ(B)≤max{κ_(max)+α+β, −β, −β+κ_(max)−κ_(min)}

The first two terms, {κ_(max)+α+β, −β}, in the argument of max are based on walks to B that are the same as in AS, and the last term, {−β+κ_(max)−κ_(min)} is based on walks to B in M that are different from ones in AS.

Step 7) Upper bounds when κ_(min)≤0 and κ_(max)≥0

Overlapping Alignment

affine modified simplified Lemma 1.2 −α − β min {−α − β, κ_(min) + β} −α − β lower bound Lemma 1.2 κ_(max) + α + β max{κ_(max) + α + κ_(max) + α + β upper bound β, −β, −β + κ_(max) − κ_(min)} Overlapping Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 1.2 −α − β min {−α − β, κ_(min) + β} −α − β lower bound Lemma 1.2 κ_(max) + α + β max{κ_(max) + α + β, −β + κ_(max) + α + β upper bound κ_(max) − κ_(min)}

B. Lemma 2.2—Lower Bound

We are given vertices C=(i,j) and A=(i,j+1), where ρ(C) denotes the best score from (0,0) to C, and σ(A) denotes the best score from (0,0) to A, over walks ending with a vertical arc. This lemma shows, 0≤ρ(C)−σ(A), for AS and M gap scores.

Proof:

1. Case 1) C≠(0,0)

We have A=C+(0,1), thus A≠(0,0), thus it has a W_(σ(A)). W _(σ(A))

((0,0)=(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s) ,j _(s))), for s≥1 W _(σ(A))

((0,0)=(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s−1) ,j _(s−1)+1)), for s≥1

Subcase 1.a) s=1

Not feasible for Case 1).

Subcase 1.b) s>1 W _(σ(A))

((0,0)=(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s−1) ,j _(s−1)+1)), for s>1 W _(σ(A)) ={acute over (W)} _(σ(A))((i _(s−1) ,j _(s−1)))★((i _(s−1) ,j _(s−1)+1))

if W_(σ(A)) belongs to M clearly so does {acute over (W)}_(σ(A))((i_(s−1),j_(s−1))).

$\begin{matrix} {{\sigma(A)} = {\overset{¯}{S}}_{W_{\sigma(A)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\sigma(A)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}} \end{matrix}$ ${\rho(C)} \geq {\overset{¯}{S}}_{{\overset{'}{W}}_{\sigma(A)}({({i_{s - 1},j_{s - 1}})})}$ ${{\rho(C)} - {\sigma(A)}} \geq {- {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}$ ρ(C) − σ(A) ≥ 0.

This also holds for banded case.

Let {circumflex over (σ)}(A) denote a best path in the band, reaching A with last arc vertical, and let {circumflex over (ρ)}(C) denote a best path in the band, reaching C.

Now, if A and C are in the band, then the above argument works when σ(A) and ρ(C) are replaced with {circumflex over (σ)}(A) and {circumflex over (ρ)}(C), respectively. W _({circumflex over (σ)}(A))

((0,0)=(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s−1) ,j _(s−1)+1)), for s>1 W _({circumflex over (σ)}(A)) ={acute over (W)} _({circumflex over (σ)}(A))((i _(s−1) ,j _(s−1)))★(i _(s−1) ,j _(s−1)+1))

if W_({circumflex over (σ)}(A)) belongs to M clearly so does {acute over (W)}_({circumflex over (σ)}(A))((i_(s−1),j_(s−1))).

if W_({circumflex over (σ)}(A)) belongs to the band, and C belongs to the band, then so does {acute over (W)}_({circumflex over (σ)}(A)) ((i_(s−1),j_(s−1))).

$\begin{matrix} {{\hat{\sigma}(A)} = {\overset{¯}{S}}_{W_{\hat{\sigma}(A)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\hat{\sigma}(A)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}} \end{matrix}$ ${\hat{\rho}(C)} \geq {\overset{¯}{S}}_{{\overset{'}{W}}_{\hat{\sigma}(A)}({({i_{s - 1},j_{s - 1}})})}$ ${{\hat{\rho}(C)} - {\hat{\sigma}(A)}} \geq {- {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}$ ρ̂(C) − σ̂(A) ≥ 0.

Case 2) C=(0,0)

We have ρ(C)=0 by definition. A=(0,1) σ(A)=v ρ(C)−σ(A)=0−v ρ(C)−σ(A)>0.

Again, the above argument works when σ(A) and ρ(C) are replaced with {circumflex over (σ)}(A) and {circumflex over (ρ)}(C), respectively.

C. Lemma 2.2 Upper Bound

We are given vertices C=(i,j) and A=(i,j+1), where ρ(C) denotes the best score from (0,0) to C, and σ(A) denotes the best score from (0,0) to A, over walks ending with a vertical arc. This lemma shows, ρ(C)−σ(A)≤α+β, for AS and ρ(C)−σ(A)≤max{κ_(max)−κ_(min)+α+β, κ_(max)−2κ_(min)+α+β}, for M gap scores.

Proof:

For AS:

1. Case 1) C≠(0,0)

We have A=C+(0,1), thus A≠(0,0).

Since C≠(0,0), we have W_(ρ(C))

((i₀,j₀), (i₁,j₁), . . . , (i_(s−1),j_(s−1)), (i_(s),j_(s))), for s≥1.

Define W

W_(ρ(C))*((i_(s),j_(s)+1))

$\begin{matrix} {{{\sigma(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{W_{\rho(C)}*{({({i_{s},{j_{s} + 1}})})}} = {{{\overset{¯}{S}}_{W_{\rho(C)} +}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)},\ {\left( {i_{s},j_{s}} \right)\left( {i_{s},{j_{s} + 1}} \right)}} \right)}} = {{\rho(C)} + v_{u}}}}} &  \end{matrix}$

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(h), then u=h.

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(v), then u=v. ρ(C)−σ(A)≤−v _(u).

2. Case 2) C=(0,0)

We have ρ(C)=0 by definition. A=(0,1) σ(A)=v ρ(C)−σ(A)=0−v ρ(C)−σ(A)=−v.

Therefore, ρ(C)−σ(A)≤α+β.

Now, if A and C are in a band, then the above argument works when σ(A) and ρ(C) are replaced with {circumflex over (σ)}(A) and {circumflex over (ρ)}(C), respectively. More specifically, if C and A belong to the band, so do:

1) arc from C to A, and

2) S _(W) _(ρ(C)) _(*((i) _(s) _(,j) _(s) ₊₁₎₎

And the argument holds.

For M:

3. Case 1) C≠(0,0)

We have A=C+(0,1), thus A≠(0,0).

Since C≠(0,0), we have W_(ρ(C))

((i₀,j₀), (i₁,j₁), . . . (i_(s−1),j_(s−1)), (i_(s),j_(s))), for s≥1.

Subcase 1.a) (i_(s−1),j_(s−1))(i_(s),j_(s))∉A^(h)

Define W

W_(ρ(C))*((i_(s),j_(s)+1)). Claim walk W does not have a horizontal (vertical) arc followed by a vertical (horizontal) arc. Follows from 1) W_(ρ(C)) does not have a horizontal (vertical) arc followed by a vertical (horizontal) arc, and 2) from 1.a) the assumption.

$\begin{matrix} \begin{matrix} {{{\sigma(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{W_{\rho(C)}*{({({i_{s},{j_{s} + 1}})})}} = {{{\overset{¯}{S}}_{W_{\rho(C)} +}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)},\ {\left( {i_{s},j_{s}} \right)\left( {i_{s},{j_{s} + 1}} \right)}} \right)}} = {{\rho(C)} + v_{u}}}}} &  \end{matrix} &  \end{matrix}$

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(v), then u=v.

It should be noted that (i_(s−1),j_(s−1))(i_(s),j_(s))∉A^(h) because of the 1.a) assumption. ρ(C)−σ(A)≤−v _(u).

Subcase 1.b) (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(h)

Sub-subcase 1.b.a) W_(ρ(C)) has no diagonal

Case 1) C≠(0,0)

Subcase 1.b) (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(h)

Sub-subcase 1.b.a) W_(ρ(C)) has no diagonal ==>W _(ρ(C))=((0,0),(0,1), . . . (0,j _(s)),(1,j _(s)),(2,j _(s)), . . . ,(i _(s−1) ,j _(s−1)),(i _(s) ,j _(s)))

it can't have a 90-degree angle anywhere except with axis. ==>ρ(C)=0, if j _(s)=0 ==>σ(A)≥p(C)+v p(C)−σ(A)≤−v ==>ρ(C)=hif j _(s)>0, and i _(s)=1 σ(A)≥κ(i _(s) ,j _(s))+v _(d) p(C)−σ(A)≤h−κ(i _(s) ,j _(s))−v _(d) ==>ρ(C)=h+(i _(s)−1)h _(h) if j _(s)>0, and i _(s)>1 σ(A)≥h+(i _(s)−2)h _(h)+κ(i _(s) ,j _(s))+v _(d) p(C)−σ(A)≤h _(h)−κ(i _(s) ,j _(s))−v _(d)

Sub-subcase 1.b.b) W_(ρ(C)) has a diagonal

4. Case 1) C≠(0,0)

Subcase 1.b) (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(h)

Sub-subcase 1.b.b) W_(ρ(C)) has a diagonal W _(ρ(C))

((0,0)=(i ₀ ,j ₀),(i ₁ ,i ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s) ,j _(s))), for s>1 i _(s) =i _(s−1)+1 j _(s) =j _(s−1)

Based on 1.bb, there is an integer p,

0≤p≤s−2, such that for W _(ρ(C))=((0,0)=(i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p+1) ,j _(p+1)), . . . ,(i _(s−1) ,j _(s−1)),(i _(s) ,j _(s)))

we have i _(q+1) =i _(q)+1, for p≤q≤s−1 j _(p+1) =j _(p)+1 j _(q+1) =j _(q), for p+1≤q≤s−1

thus, W _(ρ(C))=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1))

We define W=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1−1),(i _(p)+2,j _(p)+1−1), . . . ,(i _(p) +s−1,j _(p)+1−1),(i _(p) +s,j _(p)+1))★((i _(p) +s,j _(p)+2)) ρ(C)= S _(W) _(ρ(C)) σ(A)≥ S _(W) ρ(C)−σ(A)≤ S _(W) _(ρ(C)) −S _(W)

Part 1) p=0 W _(ρ(C))=((0,0)=(i ₀ ,j ₀),(i ₀+1,j ₀+1),(i ₀+2,j ₀+1), . . . ,(i ₀ +s−1,j ₀+1),(i ₀ +s,j ₀+1)) S _(W) _(ρ(C)) ={circumflex over (φ)}₀((0,0),(1,1))+{circumflex over (φ)}₁((0,0)(1,1),(1,1)(2,1))+Σ_(l=3) ^(s){circumflex over (φ)}₁((l−2,1)(l−1,1),(l−1,1)(l,1)) S _(W) _(ρ(C)) =κ(x ₁ ,y ₁)+h _(d)+(s−2)h _(h) W=((0,0),(1,1−1),(2,1−1), . . . ,(s−1,1−1),(s,1))★((s,2)) S _(W)={circumflex over (φ)}₀((0,0),(1,1−1))+Σ_(l=2) ^(s−1)(l−2,0)(l−2+1,1−1),(l−2+1,1−1)(l−2+2,1−1))+{circumflex over (φ)}₁((s−2,0)(s−2+1,1−1),(s−2+1,1−1)(s−2+2,1))+{circumflex over (φ)}₁((s−2+1,1−1)(s−2+2,1),(s−2+2,1)(s−2+2,2)) S _(W) =h+(s−2)h _(h)+κ(x _(s) ,y ₁)+v _(d) ρ(C)−σ(A)≤ S _(W) _(ρ(C)) −S _(W)≤κ(x ₁ ,y ₁)+h _(d)+(s−2)h _(h)−(h+(s−2)h _(h)+κ(x _(s) ,y ₁)+v _(d)) ρ(C)−σ(A)≤κ(x ₁ ,y ₁)+h _(d) −h−κ(x _(s) ,y ₁)−v _(d)

Part 2) p>0 AND (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(v) W _(ρ(C))=((0,0)=(i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1))={acute over (W)} _({circumflex over (ρ)}(C))((i _(p) ,j _(p)))★((i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1)) S _(W) _(ρ(C)) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+{circumflex over (φ)}₁((i _(p−1) ,j _(p−1))(i _(p) ,j _(p)),(i _(p) ,j _(p))(i _(p)+1,j _(p)+1))+{circumflex over (φ)}₁((i _(p) ,j _(p))(i _(p)+1,j _(p)+1),(i _(p)+1,j _(p)+1)(i _(p)+2,j _(p)+1))+Σ_(l=3) ^(s){circumflex over (φ)}₁((i _(p) +l−2,j _(p)+1)(i _(p) +l−1,j _(p)+1),(i _(p) +l−1,j _(p)+1)(i _(p) +l,j _(p)+1)) S _(W) _(ρ(C)) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h) W=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1−1),(i _(p)+2,j _(p)+1−1), . . . ,(i _(p) +s−1,j _(p)+1−1),(i _(p) +s,j _(p)+1))★((i _(p) +s,j _(p)+2))={acute over (W)} _(ρ(C))((i _(p) ,j _(p)))★((i _(p)+1,j _(p)+1−1),(i _(p)+2,j _(p)+1−1), . . . ,(i _(p) +s−1,j _(p)+1−1),(i _(p) +s,j _(p)+1))★((i _(p) +s,j _(p)+2)) S _(W) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+{circumflex over (φ)}₁((i _(p−1) ,j _(p−1))(i _(p) ,j _(p)),(i _(p) ,j _(p))(i _(p)+1,j _(p)))+Σ_(l=2) ^(s−1){circumflex over (φ)}₁((i _(p) +l−2,j _(p))(i _(p) l−2+1,j _(p)+1−1),(i _(p) +l−2+1,j _(p)+1−1)(i _(p) +l−2+2,j _(p)+1−1))+{circumflex over (φ)}₁((i _(p) +s−2,j _(p))(i _(p) +s−2+1,j _(p)+1−1),(i _(p) +s−2+1,j _(p)+1−1)(i _(p) +s−2+2,j _(p)+1))+{circumflex over (φ)}₁((i _(p) +s−2+1,j _(p)+1−1)(i _(p) +s−2+2,j _(p)+1),(i _(p) +s−2+2,j _(p)+1)(i _(p) +s−2+2,j _(p)+2)) S _(W) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎ +h _(u)+(s−2)h _(h)+κ(x _(i) _(p) _(+s) ,y _(j) _(p) ₊₁)+v _(d)

If (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(d), then u=d.

If (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(h), then u=h.

(If (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(v), then u=v) this does not occur because of the assumption of part 2 ρ(C)−σ(A)≤ S _(W) _(ρ(C)) −S _(W) ≤S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h)−( S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎ +h _(u)+(s−2)h _(h)+κ(x _(i) _(p) _(+s) ,y _(j) _(p) ₊₁)+v _(d)) ρ(C)−σ(A)≤κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d) −h _(u)−κ(x _(i) _(p) _(+s) ,y _(j) _(p) ₊₁)−v _(d)

Part 3) p>0 AND (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(v) AND p=1

The arc (i_(p−1),j_(p−1))(i_(p),j_(p)) is the first arc of W_(ρ(C)) since p=1. W _(ρ(C))=((0,0)=(i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1)) W _(ρ(C))=((0,0)=(i ₀ ,j ₀), . . . ,(i ₁ ,j ₁),(i ₁+1,j ₁+1),(i ₁+2,j ₁+1), . . . ,(i ₁ +s−1,j ₁+1),(i ₁ +s,j ₁+1)) W _(ρ(C))=((0,0)=(i ₀ ,j ₀),(i ₁ ,j ₁),(i ₁+1,j ₁+1),(i ₁+2,j ₁+1), . . . ,(i ₁ +s−1,j ₁+1),(i ₁ +s,j ₁+1)) W _(ρ(C))=((0,0),(0,1),(1,1+1),(2,1+1), . . . ,(s−1,1+1),(s,1+1)) S _(W) _(ρ(C)) ={circumflex over (φ)}₀((0,0),(0,1))+{circumflex over (φ)}₁((0,0)(0,1),(0,1)(1,2))+{circumflex over (φ)}₁((0,1)(1,2),(1,2)(2,1+1))+Σ_(l=3) ^(s){circumflex over (φ)}₁((l−2,2)(l−1,1+1),(l−1,1+1)(l,1+1)) S _(W) _(ρ(C)) =κ(x ₁ ,y ₂)+h _(d)+(s−2)h _(h)

The above S _(W) _(ρ(C)) differs from global case.

Recall s≥2. W=((0,0),(1,1),(1+1,1),(1+2,1), . . . ,(1+s−2,1),(s,2))★((s,3))

$\begin{matrix} {W = \left\{ \begin{matrix} {\left( {\left( {0,0} \right),\left( {1,1} \right),\left( {2,2} \right)} \right){\bigstar\left( \left( {2,3} \right) \right)}} & {{{if}\ s} = 2} \\ {\left( {\left( {0,0} \right),\left( {1,1} \right),\left( {2,1} \right),\left( {3,2} \right)} \right){\bigstar\left( \left( {3,3} \right) \right)}} & {{{if}\ s} = 3} \\ {\left( {\left( {0,0} \right),\left( {1,1} \right),\left( {{1 + 1},1} \right),\left( {{1 + 2},1} \right),\ldots,\left( {{1 + s - 2},1} \right),\left( {s,2} \right)} \right) \star \left( \left( {s,3} \right) \right)} & {{{if}\ s} > 3} \end{matrix} \right.} &  \end{matrix}$

If s=2, then S _(W)={circumflex over (φ)}₀((0,0),(1,1))+{circumflex over (φ)}₁((0,0)(1,1),(1,1)(2,2))+{circumflex over (φ)}₁((1,1)(2,2),(2,2)(2,3)) S _(W)=κ(x ₁ ,y ₁)+κ(x ₂ ,y ₂)+v _(d)

If s=3, then S _(W)={circumflex over (φ)}₀((0,0),(1,1))+{circumflex over (φ)}₁((0,0)(1,1),(1,1)(2,1))+{circumflex over (φ)}₁((1,1)(2,1),(2,1)(3,2))+{circumflex over (φ)}₁((2,1)(3,2),(3,2)(3,3)) S _(W)=κ(x ₁ ,y ₁)+h _(d)+κ(x ₃ ,y ₂)+v _(d) ((0,0),(1,1),(1+1,1),(1+2,1), . . . ,(1+s−2,1),(s,2))★((s,3))

If s>3, then

$\begin{matrix} {{{\overset{¯}{S}}_{W} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {0,0} \right),\left( {1,1} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {0,0} \right)\left( {1,1} \right)},{\left( {1,1} \right)\left( {2,1} \right)}} \right)} + {\sum_{l = 3}^{s - 1}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{l - 2},1} \right)\left( {{l - 1},1} \right)},{\left( {{l - 1},1} \right)\left( {l,\ 1} \right)}} \right)}} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{s - 2},1} \right)\left( {{s - 1},1} \right)},{\left( {{s - 1},1} \right)\left( {s,\ 2} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{s - 1},1} \right)\left( {s,2} \right)},{\left( {s,2} \right)\left( {s,3} \right)}} \right)}}}{{\overset{¯}{S}}_{W} = {{\kappa\left( {x_{1},y_{1}} \right)} + h_{d} + {\left( {s - 3} \right)h_{h}} + {\kappa\left( {x_{s},y_{2}} \right)} + v_{d}}}{{\overset{¯}{S}}_{W_{\rho(C)}} = {{\kappa\left( {x_{1},y_{2}} \right)} + h_{d} + {\left( {s - 2} \right)h_{h}}}}{{{{\rho(C)} - {\sigma(A)}} \leq {{\overset{¯}{S}}_{W_{\rho(C)}} - {\overset{¯}{S}}_{W}}} = \left\{ {{{{\begin{matrix} {{\kappa\left( {x_{1},y_{2}} \right)} + h_{d} + {\left( {s - 2} \right)h_{h}} - \left( {{\kappa\left( {x_{1},y_{1}} \right)} + {\kappa\left( {x_{2},y_{2}} \right)} + v_{d}} \right)} & {{{if}\ s} = 2} \\ {{\kappa\left( {x_{1},y_{2}} \right)} + h_{d} + {\left( {s - 2} \right)h_{h}} - \left( {{\kappa\left( {x_{1},y_{1}} \right)} + h_{d} + {\kappa\left( {x_{3},y_{2}} \right)} + v_{d}} \right)} & {{{if}\ s} = 3} \\ {{\kappa\left( {x_{1},y_{2}} \right)} + h_{d} + {\left( {s - 2} \right)h_{h}} - \left( {{\kappa\left( {x_{1},y_{1}} \right)} + h_{d} + {\left( {s - 3} \right)h_{h}} + {\kappa\left( {x_{s},y_{2}} \right)} + v_{d}} \right)} & {{{if}\ s} > 3} \end{matrix}{\rho(C)}} - {\sigma(A)}} \leq {{\overset{¯}{S}}_{W_{\rho(C)}} - {\overset{¯}{S}}_{W}}} = \left\{ \begin{matrix} {{\kappa\left( {x_{1},y_{2}} \right)} + h_{d} - \left( {{\kappa\left( {x_{1},y_{1}} \right)} + {\kappa\left( {x_{2},y_{2}} \right)} + v_{d}} \right)} & {{{if}\ s} = 2} \\ {{\kappa\left( {x_{1},y_{2}} \right)} + h_{h} - \left( {{\kappa\left( {x_{1},y_{1}} \right)} + {\kappa\left( {x_{3},y_{2}} \right)} + v_{d}} \right)} & {{{if}\ s} \geq 3} \end{matrix} \right.} \right.}} &  \end{matrix}$

The above bound differs from global case.

Part 4) p>0 AND (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(v) AND p>1

Since p>1, the arc (i_(p−1),j_(p−1))(i_(p),j_(p)) is not the first arc of W_(ρ(C)). W _(ρ(C))=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1))=Ŵ _(ρ(C))((i _(p−1) ,j _(p−1)))*((i _(p) ,j _(p))(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1))

Since p>1, we have S _(W) _(ρ(C)) =S _(Ŵ) _(ρ(C)) _(((i) _(p) _(−1,j) _(p) ⁻¹⁾⁾+{circumflex over (φ)}₁((i _(p−2) ,j _(p−2))(i _(p−1) ,j _(p−1)),(i _(p−1) ,j _(p−1))(i _(p) ,j _(p)))+{circumflex over (φ)}₁((i _(p−1) ,j _(p−1))(i _(p) ,j _(p)),(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1))+{circumflex over (φ)}₁((i _(p) ,j _(p))(i _(p)+1,j _(p)+1),(i _(p)+1,j _(p)+1)(i _(p)+2,j _(p)+1))+Σ_(t=3) ^(s){circumflex over (φ)}₁((i _(p) +l−2,j _(p)+1)(i _(p) +l−1,j _(p)+1),(i _(p) +l,j _(p)+1)(i _(p) +l,j _(p)+1)) S _(W) _(ρ(C)) =S _(Ŵ) _(ρ(C)) _(((i) _(p) _(−1,j) _(p) ⁻¹⁾⁾ v _(u)+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h)

If (i_(p−2),j_(p−2))(i_(p−1),j_(p−1))∈A^(d), then u=d.

If (i_(p−2),j_(p−2))(i_(p−1),j_(p−1))∈A^(h), then u=h.

If (i_(p−2),j_(p−2))(i_(p−1),j_(p−1))∈A^(v), then u=v.

u=h this does not occur because W_(ρ(C)) does not have a horizontal arc followed by a vertical arc due to M. W=((i ₀ ,j ₀), . . . ,(i _(p−1) ,j _(p−1)),(i _(p)+1,j _(p)),(i _(p)+2,j _(p)),(i _(p)+3,j _(p)), . . . ,(i _(p) +s−1,j _(p)),(i _(p) +s,j _(p)+1))*((i _(p) +s,j _(p)+2))=Ŵ _(ρ(C))((i _(p−1) ,j _(p−1)))*((i _(p)+1,j _(p)),(i _(p)+2,j _(p)), . . . ,(i _(p) +s−1,j _(p)),(i _(p) +s,j _(p)+1))*((i _(p) +s,j _(p)+2)) S _(W) =S _(Ŵ) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎+{circumflex over (φ)}₁((i _(p−2) ,j _(p−2))(i _(p−1) ,j _(p−1)),(i _(p−1) ,j _(p−1))(i _(p)+1,j _(p)))+{circumflex over (φ)}₁((i _(p−1) ,j _(p−1))(i _(p)+1,j _(p)),(i _(p)+1,j _(p))(i _(p)+2,j _(p)))+Σ_(t=3) ^(s−1){circumflex over (φ)}₁((i _(p) +l−2,j _(p))(i _(p) +l−1,j _(p)),(i _(p) +l−1,j _(p))(i _(p) +l,j _(p)))+{circumflex over (φ)}₁((i _(p) +s−2,j _(p))(i _(p) +s−1,j _(p)),(i _(p) +s−1,j _(p))(i _(p) +s,j _(p)+1))+{circumflex over (φ)}₁((i _(p) +s−1,j _(p))(i _(p) +s,j _(p)+1),(i _(p) +s,j _(p)+1)(i _(p) +s,j _(p)+2)) S _(W) =S _(Ŵ) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) )+h _(d)+(s−3)h _(h)+κ(x _(i) _(p) _(+s) ,y ₊₁)+v _(d) ρ(C)−σ(A)≤ S _(W) _(ρ(C)) −S _(W) ≤S _(Ŵ) _(ρ(C)) _(((i) _(p−1) _(,y) _(p−1) ₎₎ +v _(u)+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h)−( S _(Ŵ) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−3)h _(h)+κ(x _(i) _(p) _(+s) ,y _(p+1))+v _(d)) ρ(C)−σ(A)≤v _(u)+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(h)−κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)−κ(x _(i) _(p) _(+s) ,y _(j) _(p) ₊₁)−v _(d)

5. Case 2) C=(0,0)

We have ρ(C)=0 by definition. A=(0,1) σ(A)=v ρ(C)−σ(A)=0−v ρ(C)−σ(A)=−v.

An overall upper bound based on the upper bounds above is obtained.

Overlapping Alignment

affine modified simplified Lemma 2.2 0 0 0 lower bound Lemma 2.2 α + β max{α + β, −κ_(min) + α, κ_(max) − κ_(min) + α + β upper bound (α + β), κ_(max) − 2κ_(min) + α}

Overlapping Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 2.2 0 0 0 lower bound Lemma 2.2 α + β max{κ_(max) − κ_(min) + (α + β), α + β upper bound κ_(max) − 2κ_(min) + α}

D. Lemmas 3.2-7.2

Given the upper and lower bounds in Lemmas 1 and 2 for overlapping alignment, four more set of lower and upper bounds are driven. There are six vertices X, Y, A, B, C, and D. A is immediately above C, and X is immediately above A. D is immediately to the right of C, B is immediately to the right of A, and Y is immediately to the right of X.

Proof:

Overlapping Alignment

affine modified simplified Lemma 1.2 −α − β min {−α − β, κ_(min) + β} −α − β lower bound L₁ Lemma 1.2 κ_(max) + α + β max{κ_(max) + α + β, −β + κ_(max) + α + β upper bound κ_(max) − κ_(min)} U₁

affine modified simplified Lemma 2.2 0 0 0 lower bound L₂ Lemma 2.2 α + β max{κ_(max) − κ_(min) + (α + β), α + β upper bound κ_(max) − 2κ_(min) + α} U₂

The rest is exactly the same as the global case.

Lemma 1.2 L₁ ≤ ρ(B) − ρ(A) ≤ U₁ L₁ ≤ ρ(C) − ρ(A) ≤ U₁ Lemma 2.2 L₂ ≤ ρ(B) − σ(D) ≤ U₂ L₂ ≤ ρ(C) − τ(D) ≤ U₂ Lemma 3.2 L₃ = L₁ + L₂ ≤ ρ(B) − σ(B) ≤ U₁ + U₂ = U₃ L₃ = L₁ + L₂ ≤ ρ(C) − σ(C) ≤ U₁ + U₂ = U₃ Lemma 4.2 −U₁ + L₃ ≤ ρ(A) − σ(B) ≤ −L₁ + U₃ −U₁ + L₃ ≤ ρ(A) − σ(C) ≤ −L₁ + U₃ Lemma 5.2 −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ Lemma 6.2 L₁ − U₁ + L₃ ≤ ρ(B) − τ(C) ≤ U₁ − L₁ + U₃ L₁ − U₁ + L₃ ≤ ρ(C) − σ(B) ≤ U₁ − L₁ + U₃

1. Lemma 3.2: ρ(B)−σ(B)=ρ(B)−ρ(Y)+ρ(Y)−σ(B)=L ₁ +L ₂≤ρ(B)−σ(B)≤U ₁ +U ₂

Lemma 4.2: (ρ(A)−σ(B)=ρ(A)−ρ(B)+ρ(B)−σ(B)=−U ₁ +L ₃≤ρ(A)−σ(B)≤−L ₁ +U ₃

Lemma 5.2: ρ(B)−ρ(C)=ρ(B)−ρ(A)+ρ(A)−σ(C)=−U ₁ +L ₁≤ρ(B)−ρ(C)≤−L ₁ +U ₁

Lemma 6.2: ρ(B)−τ(C)=ρ(B)−ρ(A)+ρ(A)−ρ(C)+ρ(C)−σ(C)=L ₁ −U ₁ +L ₃≤ρ(B)−τ(C)≤U ₁ −L ₁ +U ₃

For Affine (Gotoh) gap score, the table below is generated based on above results.

Gotoh L ₁=−(α+β) U ₁=κ_(max)+α+β,κ_(max)≥0 L ₂=0 U ₂=(α+β)

Lemma 1.2 −(α + β) ≤ ρ(B) − ρ(A) ≤ κ_(max) + (α + β) −(α + β) ≤ ρ(C) − ρ(A) ≤ κ_(max) + (α + β) Lemma 2.2 0 ≤ ρ(B) − σ(D) ≤ (α + β) 0 ≤ ρ(C) − τ(D) ≤ (α + β) Lemma 3.2 −(α + β) ≤ ρ(B) − σ(B) ≤ κ_(max) + 2(α + β) −(α + β) ≤ ρ(C) − σ(C) ≤ κ_(max) + 2(α + β) Lemma 4.2 −κ_(max) − 2(α + β) ≤ ρ(A) − σ(B) ≤ κ_(max) + 3(α + β) −κ_(max) − 2(α + β) ≤ ρ(A) − σ(C) ≤ κ_(max) + 3(α + β) Lemma 5.2 −κ_(max) − 2(α + β) ≤ ρ(B) − ρ(C) ≤ κ_(max) + 2(α + β) −κ_(max) − 2(α + β) ≤ ρ(B) − ρ(C) ≤ κ_(max) + 2(α + β) Lemma 6.2 −κ_(max) − 3(α + β) ≤ ρ(B) − τ(C) ≤ 2κ_(max) + 4(α + β) −κ_(max) − 3(α + β) ≤ ρ(C) − σ(B) ≤ 2κ_(max) + 4(α + β)

The above is repeated to obtain Lemma 4.2-6.2 for the simplified and modified versions.

Lemma 7.2: The difference of any pair of values 1)-5) below is in the interval:

[LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)},and κ_(max)≥0

1) ρ(A)+κ(B)

2) ρ(B)−(α+β)

3) σ(B)−β

4) ρ(C)−(α+β)

5) τ(C)−β

Proof:

Difference of 1) and 2): from Lemmas 1.2-6.2 (α+β)≤ρ(B)−ρ(A)≤κ_(max)+(α+β) −(α+β)−(α+β)−κ(β)≤(ρ(B)−(α+β))−(ρ(A)+κ(B))+κ_(max)+(α+β)−(α+β)−κ(B) −2(α+β)−κ(B)≤(ρ(B)−(α+β))−(ρ(A)+m)≤κ_(max)−κ(B) −2(α+β)−κ_(max)≤(ρ(B)−(α+β))−(ρ(A)+κ(B))≤κ_(max)−κ_(min)

Difference of 1) and 3): from Lemmas 1.2-6.2 −κ_(max)−2(α+β)≤ρ(A)−σ(B)≤κ_(max)+3(α+β) −κ_(max)−2(α+β)+κ(B)+β≤(ρ(A)+κ(B))−(σ(B)−β)≤κ_(max)+3(α+β)+κ(B)+β −κ_(max)−2(α+β)+κ_(min)+β≤(ρ(A)+κ(B))−(σ(B)−β)≤2κ_(max)+3(α+β)+β

Difference of 1) and 4): Same as difference of 1) and 2)

Difference of 1) and 5): Same as difference of 1) and 3)

Difference of 2) and 3): from Lemmas 1.2-6.2 −(α+β)≤ρ(B)−σ(B)≤κ_(max)+2(α+β) −(α+β)−(α+β)+β≤(ρ(B)−(α+β))−(σ(B)−β)≤κ_(max)+2(α+β)−(α+β)+β −2(α+β)+β≤(ρ(B)−(α+β))−(σ(B)−β)≤κ_(max)+(α+β)+β

Difference of 2) and 4): from Lemmas 1.2-6.2 −κ_(max)−2(α+β)≤ρ(B)−ρ(C)≤κ_(max)+2(α+β) −κ_(max)−2(α+β)≤(ρ(B)−(α+β))−(ρ(C)−(α+β))≤κ_(max)+2(α+β) −κ_(max)−2(α+β)≤(ρ(B)−(α+β))−(ρ(C)−(α+1))≤κ_(max)+2(α+β)

Difference of 2) and 5): from Lemmas 1.2-6.2 −κ_(max)−3(α+β)≤ρ(B)−τ(C)≤2κ_(max)+4(α+β) −κ_(max)−3(α+β)−(α+β)+β≤(ρ(B)−(α+β))−(τ(C)−β)≤2κ_(max)+4(α+β)−(α+β)+β −κ_(max)−4(α+β)+β≤(ρ(B)−(α+β))−(τ(C)−β)≤2κ_(max)+3(α+β)+β

Difference of 3) and 4): Same as 2) and 5)

Difference of 3) and 5): from Lemmas 1.2-6.2 2κ_(max)+5(α+β)≤σ(B)−β−(τ(C)−β)=σ(B)−τ(C)≤2κ_(max)+5(α+β)

Difference of 4) and 5): Same as 2) and 3)

An interval that contains all the bounds is [LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)},and κ_(max)≥0

Lemma 7.2 is repeated for simplified and modified similarly.

The bound for values 1)-5) that include the score of the arcs is used.

A similar bound may be used for values 1′)-5′) that do not include the score of the arcs. The overall expressions in of the recursion must be reduced to a modulus based on the bound used.

1′) ρ(A)

2′) ρ(B)

3′) σ(B)

4′) ρ(C)

5′) τ(C)

V. Banded Overlapping Alignment Proof

The proof for the banded global alignment applies to the overlapping alignment case for affine and simplified gaps scores. It should be noted that in both global and overlapping alignment it is assumed that (0, 0) belongs to the BAND.

For modified gap score the following is provided for the banded overlapping alignment. The main difference between banded overlapping and banded global is that the banded overlapping has few more cases in the derivation of the Lemma 1.2 upper bound. Specifically, the walks HHP, VP and HP cover HDQ′, VQ and DQ′, respectively (except B which is assumed to be in the band). Recall that Walk W1 covers a walk W2, if diagonals that pass vertices of W2 also pass-through vertices of W1. Recall. By a diagonal it means vertices (i,j) such that i+j equal a constant.

VI. Abridged Proof of Local Alignments According to the Present Invention

Here Lemma i.3, i=1-7 are used that are given below. Note Lemmas 1.3-7.3 of the local alignment are different than Lemmas 1.1-7.1 of the global alignment. Lemmas 1.1-7.1 of the global alignment are in files with names starting with ‘Global’ and Lemmas 1.3-7.3 of the local alignment are in files with names starting with ‘local’.

Two vertices A and B are given, A is to the immediate right of B. In Lemma 1.3-lower bound, as described above for local-Lemma 1.3 lower bound, a lower bound is found for ρ(A)−ρ(B), for each of the affine, simplified and modified versions.

In Lemma 1.3-upper bound, as described above for Local-Lemma 1.3 upper bound, an upper bound is found for ρ(A)−ρ(B), for each of the affine, simplified and modified versions.

There are given two vertices A and C, A is immediately below C.

In Lemma 2.3-Lower bound, as described above for local-Lemma 2.3 lower bound, a lower bound is found for ρ(C)−σ(A), for each of the affine, simplified and modified versions.

In Lemma 2.3-Upper bound, as described above for local Lemma 2.3 upper bound, an upper bound is found for ρ(C)−σ(A), for each of the affine, simplified and modified versions.

Using Lemmas 1.3 and 2.3 results Lemma 3.3-6.3 is obtained for affine, simplified and modified cases, as described above with reference to local-Lemmas 3.3-7.3.

Using Lemmas 1.3-6.3 a bound is generate for modulus operation for affine (Gotoh) algorithm in Lemma 7.3, as described below.

Difference of any pair of values from 1)-5) falls in the range:

[LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)},and κ_(max)≥0

1) ρ(A)+κ(B)

2) ρ(B)−(α+β)

3) σ(B)−β

4) ρ(C)−(α+β)

5) τ(C)−β

Proof of Lemma 7.3 is provided below.

Next, it is shown that the Lemmas 1.3-7.3 apply for the banded local alignment. Therefore, the results extend to the banded local alignment case, as described above with reference to Banded Local Condition Section.

It should be noted that: (1) The local algorithm may be shown to run modular scores if we can null negative scores. (2) The method of the present embodiments for local alignment may be modified to perform the following. During application of the recursion equations for each vertex, it additionally performs finding the location of a vertex with maximal score along a path travelled to reach the current vertex, then it stores both the location and the score. These values are used at the to find the location and score of a vertex with an overall maximal score. There is no need to keep these values for all vertices. Once they are processed for the adjacent vertices they can be erased, except we need to keep them for relevant boundary vertices-those without a follower vertex. (3) To shorten the disclosure, we have not focused on specific terminating conditions for the alignments. These may be accomplished by someone skilled in the art, mostly based on existing methods.

The above description presents the best mode contemplated for carrying out the present embodiments, and of the manner and process of practicing them, in such full, clear, concise, and exact terms as to enable any person skilled in the art to which they pertain to practice these embodiments. The present embodiments are, however, susceptible to modifications and alternate constructions from those discussed above that are fully equivalent. Consequently, the present invention is not limited to the particular embodiments disclosed. On the contrary, the present invention covers all modifications and alternate constructions coming within the spirit and scope of the present disclosure. For example, the steps in the processes described herein need not be performed in the same order as they have been presented, and may be performed in any order(s). Further, steps that have been presented as being performed separately may in alternative embodiments be performed concurrently. Likewise, steps that have been presented as being performed concurrently may in alternative embodiments be performed separately.

A. Lemma 1.3—Lower Bound

Given vertices B=(i,j) and A=(i+1,j), we have −α−β≤ρ(A)−ρ(B), for affine and affine simplified gap score, and min{−α−β, κ_(min)+β}≤ρ(A)−ρ(B), for modified gap score. Proof: Let row(B)=i and col(B)=j. Also, M denotes modified gap score and AS denotes Affine and simplified gap scores.

1. Case: Row(B)=0 and Col(B)≥0

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}.

B=(t,0), for an integer t, 0≤t≤n−1, hence A=(t+1,0).

If t=0 then B=(0,0) A=(1,0) ρ(B)=0

Let walk W be ((0,0), (1,0)).

$\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {0,0} \right),\left( {1,0} \right)} \right)}} \\ {= h} \end{matrix}$

Therefore, h≤ρ(A)−ρ(B).

But if 0<t≤n−1 then B=(t,0) A=(t+1,0)

Now, W_(ρ(B)) has length 1 by Lemma WT. Thus W_(ρ(B))=((t−1,0), (t,0)), so

$\begin{matrix} {{\rho(B)} = {\overset{¯}{S}}_{W_{\rho(B)}}} \\ {= {{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{t - 1},0} \right),\ \left( {t,0} \right)} \right)}} \\ {= h} \end{matrix}$

Similarly, W_(ρ(A)) has length 1 by Lemma WT. Thus W_(ρ(A))=((t,0), (t+1,0)), so

$\begin{matrix} {{\rho(A)} = {\overset{¯}{S}}_{W_{\rho(A)}}} \\ {= {{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {t,0} \right),\ \left( {t + {1,0}} \right)} \right)}} \\ {= h} \end{matrix}$

Therefore, 0=ρ(A)−ρ(B).

Holds for AMS good for all cases.

Case: row(B)>0 and col(B)=0

Vertex set of D(x,y) is

={(i,j), f or 0≤i≤n and 0≤j≤m}.

We have B=(0,t), for 1<t≤m, hence A=(1, t).

Now, W_(ρ(B)) has length 1 by Lemma WT. Thus W_(ρ(B))=((0,t−1), (0,t)), so

$\begin{matrix} {{\rho(B)} = {\overset{¯}{S}}_{W_{\rho(B)}}} \\ {= {{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {0,{t - 1}} \right),\ \left( {0,t} \right)} \right)}} \\ {= v} \end{matrix}$

Also, since A NOT (0,0), we have ρ(A)≥max({κ(x₁,y_(t)),h,v})

Therefor, ρ(A)−ρ(B)≥v−v=0. 0≤ρ(A)−ρ(B)

Holds for AMS, good for all cases.

Case: row(B)>1 and col(B)>1

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}.

${B = \left( {i_{B},j_{B}} \right)}{{W_{\rho(B)} = \left( {\left( {i_{0},j_{0}} \right),\left( {i_{1},j_{1}} \right),\ldots,{\left( {i_{s},j_{s}} \right) = B}} \right)},{{s > {0. W}} = {W_{\rho(B)}\left( \left( {i_{A},j_{A}} \right) \right)}}}{\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{W_{\rho(B)}} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},{\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}}} \\ {= {{\overset{¯}{S}}_{W_{\rho(B)}} + h_{u}}} \\ {= {{\rho(B)} + h_{u}}} \end{matrix}}{h_{u} \leq {{\rho(A)} - {\rho(B)}}}$

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(h), then u=h.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∉A^(v), then u=v.

OK for AS

OK for M except u=v=>h_(v)=>W not a valid walk for ρ(A) in M

Below is in M space:

two cases:

1) s=1 W _(ρ(B))((i ₀ ,j ₀),(i _(s) ,j _(s))=B) ρ(B)=v ρ(A)≥max({κ(x _(i) _(A) ,y _(j) _(A) ),h,v})[SINCE A IS NOT (0,0)] ρ(A)≥v 0≤ρ(A)−ρ(B)

2) s>1 {acute over (W)} _(ρ(B))((i _(l) ,j _(l)))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l))), for 0≤l≤s. W _(ρ(B)) ={acute over (W)} _(ρ(B))((i _(s−1) ,j _(s−1)))(i _(s) ,j _(s)) W={acute over (W)} _(ρ(B))((i _(s−1) ,j _(s−1)))((i _(A) ,j _(A)))

$\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} +}} \\ {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{A},j_{A}} \right)}} \right)} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)}}} \end{matrix}\begin{matrix} {{\rho(B)} = {\overset{¯}{S}}_{W_{\rho(B)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} +}} \\ {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)} \end{matrix}{{{{\rho(A)} - {\rho(B)}} \geq {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}} = {{\kappa\left( {x_{i_{A}},y_{i_{A}}} \right)} - v_{z}}}{{{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - v_{z}} \leq {{\rho(A)} - {\rho(B)}}}$

If (i_(s−2),j_(s−2))(i_(s−1),j_(s−1))∈A^(d), then z=d.

If (i_(s−2),j_(s−2))(i_(s−1),j_(s−1))∈A^(h), then z=h. W_(ρ(B)) is not a valid walk in M. (unless j_(B)=1, which is not.)

If (i_(s−2),j_(s−2))(i_(s−1),j_(s−1))∈A^(v), then z=v.

Case: row(B)=1 and col(B)>1

Vertex set of D(x,y) is

={(i,j), for 0≤i≤n and 0≤j≤m}. B=(i _(B) ,j _(B)) W _(ρ(B))=((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s) ,j _(s))=B), s>0. W=W _(ρ(B))(i _(A) ,j _(A))

$\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{W_{\rho(B)}} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},\ {\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}}} \\ {= {{\overset{¯}{S}}_{W_{\rho(B)}} + h_{u}}} \\ {= {{\rho(B)} + h_{u}}} \end{matrix}$ h _(u)≤ρ(A)−ρ(B)

If (i_(s−1),j_(s−1))(i_(B),i_(B))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(h), then u=h.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(v), then u=v.

OK for AS

OK for M except u=v=>h_(v)=>W not a valid walk for ρ(A) in M

Below is in M space:

two cases:

1) s=1 W _(ρ(B))=((i ₀ ,j ₀),(i _(s) ,j _(s))=B) ρ(B)=v ρ(A)≥max({κ(x _(i) _(A) ,y _(j) _(A) ),h,v})[SINCE A IS NOT (0,0)] ρ(A)≥v 0≤ρ(A)−ρ(B)

2) s>1 {acute over (W)} _(ρ(B))((i _(l) ,j _(l)))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l))), for 0≤l≤s. W _(ρ(B)) ={acute over (W)} _(ρ(B))((i _(s−1) ,j _(s−1)))(i _(s) ,j _(s)) W={acute over (W)} _(ρ(B))((i _(s−1) ,j _(s−1)))((i _(A) ,j _(A)))

$\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} +}} \\ {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{A},j_{A}} \right)}} \right)} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)}}} \end{matrix}\begin{matrix} {{\rho(B)} = {\overset{¯}{S}}_{W_{\rho(B)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} +}} \\ {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)} \end{matrix}{{{{\rho(A)} - {\rho(B)}} \geq {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}} = {{\kappa\left( {x_{i_{A}},y_{i_{A}}} \right)} - v_{z}}}{{{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - v_{z}} \leq {{\rho(A)} - {\rho(B)}}}$

If (i_(s−2),j_(s−2))(i_(s−1),j_(s−1))∈A^(d), then z=d. Not valid arc

;

If (i_(s−2),j_(s−2))(i_(s−1),j_(s−1))∈A^(h), then z=h. this does not happen in M;

If (i_(s−2),j_(s−2))(i_(s−1),j_(s−1))∈A^(v), then z=v. Not valid arc

;

Case: row(B)>1 and col(B)=1

Vertex set of D(x,Y) is

={(i,j), for 0≤i≤n and 0≤j≤m}. B=(i _(B) ,j _(B)) W _(β(B))=((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s) ,j _(s))=B), s>0. W=W _(β(B))((i _(A) ,j _(A)))

$\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{W_{\rho(B)}} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},\ {\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}}} \\ {= {{\overset{¯}{S}}_{W_{\rho(B)}} + h_{u}}} \\ {= {{\rho(B)} + h_{u}}} \end{matrix}{h_{u} \leq {{\rho(A)} - {\rho(B)}}}$

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(h), then u=h.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(v), then u=v.

OK for AS

OK for M except u=v=>h_(v)=>W not a valid walk for ρ(A) in M

Below is in M space:

two cases:

1) s=1 W _(ρ(B))=((i ₀ ,j ₀),(i _(s) ,j _(s))=B) ρ(B)=v ρ(A)≥max({κ(x _(i) _(A) ,y _(j) _(A) ),h,v}) [SINCE A IS NOT (0,0)] ρ(A)≥v 0≤ρ(A)−ρ(B)

2) s>1 {acute over (W)} _(β(B))((i _(l) ,j ₁))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l)), for 0≤l≤s. W _(ρ(B)) ={acute over (W)} _(ρ(B))(i _(s−1) ,j _(s−1)))(i _(s) ,j _(s)) W={acute over (W)} _(β(B))(i _(s−1) ,i _(s−1)))(i _(A) ,j _(A)))

${\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} +}} \\ {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{A},j_{A}} \right)}} \right)} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)}}} \end{matrix}\begin{matrix} {{\rho(B)} = {\overset{¯}{S}}_{W_{\rho(B)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} +}} \\ {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)} \end{matrix}}{{{{\rho(A)} - {\rho(B)}} \geq {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}} = {{\kappa\left( {x_{i_{A}},y_{i_{A}}} \right)} - v_{z}}}{{{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - v_{z}} \leq {{\rho(A)} - {\rho(B)}}}$

if u=v and s>1 and z=d, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(d)≤ρ(A)−ρ(B) in M

if u=v and s>1 and z=h, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(h)≤ρ(A)−ρ(B) does not happen in M

if u=v and s>1 and z=v and j_(B)=2, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B) W_(ρ(B)) not valid based on Lemma WT.

if u=v and s>1 and z=v and j_(B)>2, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B) in M

Case: row(B)=1 and col(B)=1

Vertex set of D(x,y) is

{(i,j), for 0≤i≤n and 0≤j≤m}. B=(i _(B) ,j _(B)) W _(β(B))=((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s) ,j _(s))=B), s>0. W=W _(β(B))((i _(A) ,j _(A)))

$\begin{matrix} {{{\rho(A)} \geq {\overset{¯}{S}}_{W}} = {{\overset{¯}{S}}_{W_{\rho(B)}} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{B},j_{B}} \right)},\ {\left( {i_{B},j_{B}} \right)\left( {i_{A},j_{A}} \right)}} \right)}}} \\ {= {{\overset{¯}{S}}_{W_{\rho(B)}} + h_{u}}} \\ {= {{\rho(B)} + h_{u}}} \end{matrix}{h_{u} \leq {{\rho(A)} - {\rho(B)}}}$

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(h), then u=h.

If (i_(s−1),j_(s−1))(i_(B),j_(B))∈A^(v), then u=v.

OK for AS

OK for M except u=v=>h_(v)=>W not a valid walk for ρ(A) in M

Below is in M space:

two cases:

1) s=1 W _(ρ(B))=((i ₀ ,j ₀),(i _(s) ,j _(s))=B) ρ(B)=v ρ(A)≥max({κ(x _(i) _(A) ,y _(j) _(A) ),h,v}) [SINCE A IS NOT (0,0)] ρ(A)≥v 0≤ρ(A)−ρ(B)

2) s>1

{acute over (W)} _(β(B))((i _(l) ,j _(l)))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l)), for 0≤l≤s. W _(ρ(B)) ={acute over (W)} _(ρ(B))(i _(s−1) ,j _(s−1)))(i _(s) ,j _(s)) W={acute over (W)} _(β(B))(i _(s−1) ,i _(s−1)))(i _(A) ,j _(A)))

$\begin{matrix} {{\rho(A)} \geq {\overset{¯}{S}}_{W}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{A},j_{A}} \right)}} \right)}}} \\ {= {{\overset{¯}{S}}_{{{\overset{'}{W}}_{\rho(B)}({i_{s - 1},j_{s - 1}})})} + {\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)}}} \end{matrix}$ $\begin{matrix} {{\rho(B)} = {\overset{¯}{S}}_{W_{\rho(B)}}} \\ {{\overset{¯}{S}}_{{\overset{'}{W}}_{\rho(B)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}} \end{matrix}$ $\begin{matrix} {{{\rho(A)} - {\rho(B)}} \geq {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)}} \right)}}} \\ {= {{\kappa\left( {x_{i_{A}},y_{j_{A}}} \right)} - v_{z}}} \end{matrix}$ κ(x_(i_(A)), y_(j_(A))) − v_(z) ≤ ρ(A) − ρ(B)

if u=v and s>1 and z=d, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(d)ρ(A)−ρ(B); not valid arc of

if u=v and s>1 and z=h, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(h)≤ρ(A)−ρ(B) does not happen in M

if u=v and s>1 and z=v, then κ(x_(i) _(A) ,y_(j) _(A) )−v_(v)≤ρ(A)−ρ(B); not valid arc of

For AS h≤ρ(A)−ρ(B) 0=ρ(A)−ρ(B) h _(u)≤ρ(A)−ρ(B)

u=d, h, or v

least lower bound AS=min{0, h, h_(d), h_(h), h_(v)}=−(α+β)

least lower bound AS=−(α+β)

For M 0≤ρ(A)−ρ(B) κ(x _(i) _(A) ,y _(j) _(A) )−v _(z)≤ρ(A)−ρ(B) z=dv least lower bound M=min{0,−(α+β),κ_(min) −v _(d),κ_(min) −v _(v)}=min{−(α+β),κ_(min)+(α+β),κ_(min)+β}=min{−(α+β),κ_(min)+β} least lower bound M=min{−(α+β),κ_(min)+β}

affine modified simplified Lemma 1.3 L −α − β min{−α − β, κ_(min) + β} −α − β Lemma 1.3 R Lemma 2.3 L Lemma 2.3 R

affine modified simplified Lemma 1.3 L −α − β min{−α − β, κ_(min) + β} −α − β Lemma 1.3 R Lemma 2.3 L Lemma 2.3 R

B. Lemma 1.3—Upper Bound

Given vertices B=(i,j) and A=(i+1,j), ρ(A)−ρ(B)≤max{κ_(max)+α+β, 0}, for affine and affine simplified gap score, and ρ(A)−ρ(B)≤max{κ_(max)+α+β, −β, −β+κ_(max)−κ_(min)}, for modified gap score. Proof: Briefly, for every possible walk for ρ(A), we find a walk W(B) of B such that ρ(A)−Score of (W(B))≤upper bound.

Step 1) All possible walks for ρ(A):

This section characterized all possible walks for ρ(A), and their corresponding W(B)

In order to find an upper bound to ρ(A)−ρ(B), following cases are considered.

Notations:

row=row of the dark circle in digraph D(x,y).

col=column of the dark circle on digraph D.

ticker lines are possible walks of ρ(A).

thinner lines are possible arcs leading to B.

D, H and V mark a diagonal, horizontal and vertical arc, respectively.

dashed thick lines are invalid for ρ(A) for modified gap score.

dashed thin lines are invalid for certain walks to B for modified gap score.

1. Case 1: Row>1 and Col=2

FIG. 28A shows a table 2801 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks being valid with respect to local alignment with the specific affine gap function.

Table 2801 has 4 rows and 6 columns. Note these are different from the row and columns on Digraph D. The second row and fifth column of Table 2801 shows portions of three possible walks for ρ(A) for AS.

The first portion has the arc H ending on vertex O, followed by a diagonal edge, followed by r (r≥=0) vertical arc(s) ending on A. Let's use, P, to denote the walk from the dark circle to A. Let's denote this walk by HP.

The second portion has the arc D ending on vertex O, followed by P. Let's denote this walk by DP. The third portion has the arc V ending on vertex O, followed by P. Let's denote this walk by VP. The second row and fifth column of Table 2801 also shows portions of three possible walks ending on B for AS.

The first portion has the arc H ending on vertex O, followed by one or more vertical arcs ending on B. Let's use, Q, to denote the vertical walk from the dark circle to B. Let's denote the first walk by HQ. The second portion has the arc D ending on vertex O, followed by Q. Let's denote this walk by HQ. The third portion has the arc V ending on vertex O, followed by Q. Let's denote this walk by VP. If ρ(A) contains HP, then we will use HQ to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains DP, then we will use DQ to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains VP, then we will use VQ to obtain an upper bound for ρ(A)−ρ(B).

It should be noted that the fourth and sixth columns of the table are for cases when the dark circle is on vertex (0,0). These cases are not valid for row>1 and col=2.

The third row and fifth column of Table 2801 shows additional portions of three possible walks for ρ(A) for AS.

The first portion has the arc H ending on vertex O, followed by a horizontal edge, followed by r (r≥=1) vertical arc(s) ending on A. Let's use, U, to denote the walk from the dark circle to A. Let's denote this walk by HU. The second portion has the arc D ending on vertex O, followed by U. Let's denote this walk by DU. The third portion has the arc V ending on vertex O, followed by U. Let's denote this walk by VU.

The third row and fifth column of Table 2801 also shows portions of three possible walks ending on B for AS. The first portion has the arc H ending on vertex O, followed by one or more vertical arcs ending on B.

Let's use, W, to denote the vertical walk from the dark circle to B. Let's denote the first walk by HW. The second portion has the arc D ending on vertex O, followed by W. Let's denote this walk by HW.

The third portion has the arc V ending on vertex O, followed by W. Let's denote this walk by VW.

If ρ(A) contains HU, then we will use HW to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains DU, then we will use DW to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains VU, then we will use VW to obtain an upper bound for ρ(A)−ρ(B).

The fourth row and fifth column of Table 2801 shows yet more portions of three possible walks for ρ(A) for AS. The first portion has the arc H ending on vertex O, followed by a horizontal arc to A. Let's use, X, to denote the arc from the dark circle to A. Let's denote this walk by HX. The second portion has the arc D ending on vertex O, followed by X. Let's denote this walk by DX. The third portion has the arc V ending on vertex O, followed by X. Let's denote this walk by VX. The fourth row and fifth column of Table 2801 also shows portions of three possible walks for ρ(A) for AS.

The first portion has the arc H ending on vertex O, but vertex O and vertex B are the same here. Let's call this walk H. The second portion has the arc D ending on vertex B (O). Let's denote this walk by D. The third portion has the arc V ending on vertex B. Let's denote this walk by V.

If ρ(A) contains HX, then we will use H to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains DX, then we will use D to obtain an upper bound for ρ(A)−ρ(B). If ρ(A) contains VX, then we will use V to obtain an upper bound for ρ(A)−ρ(B).

The second row and third column of Table 2801 shows the walks HP, DP and VP of ρ(A) for M.

Here, HQ is not a valid walk to reach B since no right angles are allowed. Therefore, for H, we need to find another walk for B, which is valid in M. To this end, the arc H is extended backwards by arcs H1, D1, and V1.

Now, H1 is not valid for ρ(A) since col=2 and it would generate a 90 degree turn from the col=0.

Also, V1 is not valid for ρ(A) since it is perpendicular to H.

But D1 is a valid extension. We demote a walk for ρ(A) that uses H by D1HP, and a walk for B corresponding to D1HP by D1D0Q′, where Q′ is the walk from the empty circle square to B.

If ρ(A) contains D1HP in M, then D1D0Q′ is used to obtain an upper bound for ρ(A)−ρ(B).

The third row and third column of Table 2801 shows the walks HU, DU and VU of ρ(A) for M.

Here, U is not a valid walk for ρ(A) for M since it has a right angle turn. Therefore, there are no walks of the type described in this the third row and third column of the table for ρ(A) for M.

The fourth row and third column of the table also shows portions of three possible walks for ρ(A) for M: HX, DX, and HX.

VX is not valid for M because of its right angle. Therefore,

If ρ(A) contains HX, then H is used to obtain an upper bound for ρ(A)−ρ(B).

If ρ(A) contains DX, then D is used to obtain an upper bound for ρ(A)−ρ(B).

FIG. 28B shows a table 2802 that for each affine gap function, characterized whether the walk from the top circle (row>1 and column=2) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure. Table 2802 addresses additional cases when the walk for ρ(A) start not from vertex (0,0). The second row and the last column of the table shows a walk for ρ(A) for AS: FY. FY is the walk from the dark circle to A. The arc is called Y, and F denotes that the walk starts on the dark circle. If ρ(A) is FY, then ρ(B)≥v, is used to obtain an upper bound for ρ(A)−ρ(B).

The following cases 2-10, are derived as case 1.

2. Case 2: Row>1 and Col>2

FIG. 29A shows a table 2901 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 29B shows a table 2902 that for each affine gap function, characterized whether the walk from the top circle (row>1 and column>2) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure. Table 2903 addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

3. Case 3: Row=1 and Col=2

FIG. 30A shows a table 3001 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=2, such that one ends in A and the other ends in B according to various aspects of the present disclosure. Both walks being valid with respect to local alignment with the specific affine gap function.

FIG. 30B shows a table 3002 that for each affine gap function, characterized whether the walk from the top circle (row=1 and column=2) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function according to various aspects of the present disclosure. Table 3002 below addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

4. Case 4: Row=1 and Col>2

FIG. 31A shows a table 3101 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>2, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 31B shows a table 3102 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>2, such that one ends in A and the other ends in A, according to various aspects of the present disclosure. Both walks being valid with respect to local alignment with the specific affine gap function. Table 3102 addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

5. Case 5: Row>1 and Col=1

Table below addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

FIG. 32A shows a table 3201 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row>1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 32B shows a table 3202 that for each affine gap function, characterized whether the walk from the top circle (row>1 and column=1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure.

6. Case 6: Row=1 and Col=1

FIG. 33A shows a table 3301 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 33B shows a table 3302 that for each affine gap function, characterized whether the walk from the top circle (row=1 and column=1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure. Table 3302 addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

7. Case 7: Row>0 and Col=0

FIG. 34A shows a table 3401 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 34B shows a table 3402 that for each affine gap function, characterized whether the walk from the top circle (row=0 and column=0) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure. Table 3402 addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

8. Case 8: Row=1 and Col>1

FIG. 35A shows a table 3501 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=1 and column>1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 35B shows a table 3502 that for each affine gap function, characterized whether the walk from the top circle (row=1 and column>1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure. Table 3502 addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

9. Case 9: Row=0 and Col=1

FIG. 36A gives a table 3601 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=1, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 36B gives a table 3602 that for each affine gap function, characterized whether the walk from the top circle (row=0 and column=1) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure. Table 3602 addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

10. Case 10: Row=0 and Col=0

FIG. 37A shows a table 3701 that for each affine gap function, characterized all pairs of walks that diverge from a vertex in a row=0 and column=0, such that one ends in A and the other ends in B, according to various aspects of the present disclosure. With reference to FIG. 37A, Q″ is the last vertical arc ends in B. Both walks are valid with respect to local alignment with the specific affine gap function.

FIG. 37B shows a table 3702 that for each affine gap function, characterized whether the walk from the top circle (row=0 and column=0) to A could be a valid walk for ρ(A) with respect to local alignment with the specific affine gap function, according to various aspects of the present disclosure. Table 3702 addresses additional cases when the walk for ρ(A) start not from vertex (0,0).

Step 2) Tabulation of all possible walks for ρ(A), and their corresponding W(B).

Tables below describes all possible walks for ρ(A), and their corresponding W(B) for AS and M.

AS:

D=diagonal tail

H=horizontal tail

V=vertical tail

F=no tail

Based on the tables on pairs of walks on digraph D(x,y), table below gives pairs of walks that are valid for AS. The pairs in bold are not valid.

01 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ FQ DW HW VW XX D H V F C = 2 02 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX DW HW VW XX D H V F C > 2 03 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX DW HW VW XX D H V F C = 2 04 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX DW HW VW XX D H V F C > 2 05 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX DW HW VW XX D H V F C = 1 06 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX DW HW VW XX D H V F C = 1 07 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 0 DQ HQ VQ XX DW HW VW XX D H V F C = 0 08 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ DQ′ DW HW VW XX D H V F C > 1 09 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ DQ′ DW HW VW XX D H V F C = 1 10 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ Q′ DW HW VW FW D H V F C = 0

M:

Based on the tables on pairs of walks on digraph D(x,y), table below gives pairs of walks that are valid for M. The pairs in bold are not valid.

Underbar means not valid for AS, as well.

01 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX XX XX XX XX D H V F C = 2 DHP DDQ′ HHP HDQ′ VHP VDQ′ FHP FDQ′ 02 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ FQ XX XX XX XX D H V F C > 2 DHP DDQ′ HHP HDQ′ VHP VDQ′ FHP FDQ′ 03 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX XX XX XX XX D H V F C = 2 DHP DDQ′ HHP HDQ′ VHP VDQ′ FHP FDQ′ 04 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX XX XX XX XX D H V F C > 2 DHP DDQ′ HHP HDQ′ VHP VDQ′ FHP FDQ′ 05 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 1 DQ HQ VQ XX XX XX XX XX D H V F C = 1 HP VX DQ′ not valid in M 06 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 1 DQ HQ VQ XX XX XX XX XX D H V F C = 1 07 DP HP VP FP DU HU VU FU DX HX VX FX FY R > 0 DQ HQ VQ XX XX XX XX XX D H V F C = 0 08 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ DQ′ XX XX XX XX D H V F C > 1 09 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ DQ′ XX XX XX XX D H V F C = 1 10 DP HP VP FP DU HU VU FU DX HX VX FX FY R = 0 DQ HQ VQ Q′ XX XX XX XX D H V F C = 0

Step 3) The scores of all possible walks for ρ(A), and their corresponding W(B).

This step we calculate the score of all the walk in the tables of step 2).

We start with the following definitions.

Definitions: A=(i _(A) ,j _(A)) W _(ρ(A))=((i ₀ ,j ₀)),(i ₁ ,j ₁), . . . ,(i _(t) ,j _(t))=A), t>0. {acute over (W)} _(ρ(A))((i _(l) ,j _(l)))

(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l))), for 0≤l≤t. {grave over (W)} _(ρ(A))((i _(l) ,j _(l)))

(i _(l) ,j _(l)),(i _(l+1) ,j _(l+1)), . . . ,(i _(t) ,j _(t))=A), for 0≤l≤t. P ^(|)((i,j);r)

((i,j+1),(i,j+2), . . . (i,j+r)), for integers, i≥0, j≥0 and r≥0. P ^(|)((i,j);0)

(ϕ) P ^(d|)((i,j;r)

((i,j),(i+1,j+1))P ^(|)((i+1,j+1);r), for integers, i≥0, j≥0 and r≥0.

(We use W₁W₂ and W₁★W₂ to represent the concatenation of the sequences (or walks) W₁ and W₂).

p^(h|)((i,j; r)

((i,j), (i+1, j))P^(|)((i+1, j); r), for integers, i≥0, j≥0 and r≥0.

P^(f)((i,j))

((i,j), (i+1, j)), for integers, i≥0 and j≥0. P ^(v|)((i,j);r)

((i,j))P ^(|)((i,j);r), for integers, i≥0, j≥0 and r≥0. ρ((0,0))

0

Lemma T. Given two walks W₁ and W₂, W ₁=(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(k−1) ,j _(k−1)),(i _(k) ,j _(k))(i _(k+1) ,j _(k+1)),(1_(k+2) ,j _(k+2)), . . . ,(i _(p) ,i _(p))) W ₂=(i′ ₀ ,j′ ₀),(i′ ₁ ,j′ ₁), . . . ,(i′ _(k−1) ,j′ _(k−1)),(i′ _(k) ,j′ _(k))(i′ _(k+1) ,j′ _(k+1)),(i′ _(k+2) ,j′ _(k+2)), . . . ,(i′ _(p) ,j′ _(p)))

that agree in vertices: (i_(m),j_(m))=(i′_(m),j′_(m)), m≤k, we have S _(W) ₁ −S _(W) ₂ =Σ_(q=k) ^(p)({circumflex over (φ)}₁((i _(q−1) ,j _(q−1))(i _(q) ,j _(q)),(i _(q) ,j _(q))(i _(q+1) ,j _(q+1)))−{circumflex over (φ)}₁((i′ _(q−1) ,j′ _(q−1))(i′ _(q) ,j′ _(q)),(i′ _(q) ,j′ _(q))(i′ _(q+1) ,j′ _(q+1))))

We use the following correspondence.

(a) DP (b) HD (c) VD (d) FD (e) DU (f) HU (g) VH (h) FU (i) DX (j) HX (k) VX (l) FX (m) FY (n) DP (o) HD (p) VD (q) FD (n) DU (o) HU (p) VH (q) FU (r) DX (s) HX (t) VX (u) FX (i) FY (v) DHP (w) HHD (x) VHD (y) FHD AA DDQ′ BB HDQ′ CC VDQ′ DD FDQ′

We define more notions to identify the walks of interest.

For AS: r≥0 T _(d) P ^(d|)((i,j);r)

((i−1,j−1))P ^(d|)((i,j);r)  (a) T _(h) P ^(d|)((i,j);r)

((i−1,j))P ^(d|)((i,j);r)  (b) T _(v) ^(d|)((i,j);r)

((i,j−1))P ^(d|)((i,j);r)  (c) T _(ϕ) P ^(d|)((i,j);r)

(ϕ)P ^(d|)((i,j);r)  (d) s>0 T _(d) P ^(h|)((i,j);s)

((i−1,j−1))P ^(h|)((i,j);s)  (e) T _(h) P ^(h|)((i,j);s)

((i−1,j))P ^(h|)((i,j);s)  (f) T _(V) P ^(h|)((i,j);s)

((i,j−1))P ^(h|)((i,j);s)  (g) T _(ϕ) P ^(h|)((i,j);s)

(ϕ)p ^(h|)((i j);s)  (h) T _(d) P ^(f)(i,j)

T _(d)((i,j)(i+1,j))  (i) T _(h) P ^(f)(i,j)

T _(h)((i,j)(i+1,j))  (j) T _(V) P ^(f)(i,j)

T _(V)((i,j)(i+1,j))  (k) T _(ϕ) P ^(f)(i,j)

T _(V)((i,j)(i+1,j))  (l) s=1 T _(ϕ) P ^(v|)((i,j);r)

(ϕ)((i,j))P ^(|)((i,j);s)  (m) s>0 T _(d) P ^(v|)((i,j);s)

T _(d)((i,j))P ^(|)((i,j);s)  (n) T _(h) P ^(v|)((i,j);s)

T _(h)((i,j))P ^(|)((i,j);s)  (o) T _(v) P ^(v|)((i,j);s)

T _(v)((i,j))P ^(|)((i,j);s)  (p) T _(ϕ) P ^(v|)((i,j);s)

T _(ϕ)((i,j))P ^(|)((i,j);s)  (q) T _(d)((i,j))  (r) T _(h)((i,j))  (s) T _(v)((i,j))  (t) T _(ϕ)((i,j))  (u)

For M: r≥0 T _(d) T _(h) P ^(d|)((i,j);r)

((i−2,j−1))((i−1,j))P ^(d|)((i,j);r)  (v) T _(h) T _(h) P ^(d|)((i,j);r)

((i−2,j))((i−1,j))P ^(d|)((i,j);r)  (w) T _(v) T _(h) P ^(d|)((i,j);r)

((i−1,j−1))((i−1,j))P ^(d|)((i,j);r)  (x) T _(ϕ) T _(h) P ^(d|)((i,j);r)

(ϕ)((i−1,j))P ^(d|)((i,j);r)  (y) r≥0 T _(d) T _(d) P ^(v|)((i,j+1);r)

T _(d) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (AA) T _(h) T _(d) P ^(v|)((i,j+1);r)

T _(h) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (BB) T _(v) T _(d) P ^(v|)((i,j+1);r)

T _(v) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (CC) T _(ϕ) T _(d) P ^(v|)((i,j+1);r)

T _(ϕ) T _(d)((i,j+1))P ^(|)((i,j+1);r)  (DD)

Below we compute the score of the walks characterized above:

Case: i>1, j>1; (a)(b)(c)(d); r≥0

$\begin{matrix} {\left. {{T_{d}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = \left( {{i - 1},{j - 1}} \right)} \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}} \\ {\left. {= \left( {{i - 1},{j - 1}} \right)} \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}} \\ {{\left. {= \left( {{i - 1},{j - 1}} \right)} \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}\begin{pmatrix} {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{\_}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{\_}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ $\begin{matrix} {\left. {{T_{v}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = \left( {{i - 1},j} \right)} \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}} \\ {\left. {= \left( {{i - 1},j} \right)} \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}} \\ {{\left. {= \text{}\left( {{i - 1},j} \right)} \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}\begin{pmatrix} {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{\_}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{\_}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} = {v + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ $\begin{matrix} {{T_{\phi}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {(\phi){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {= {\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}}} \\ {= \text{}{\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)\left( {\left( {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),{\ldots\left( {{i + 1},{j + 1 + r}} \right)}} \right.}} \end{matrix}$ ${\overset{\_}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} = {{{\hat{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{\_}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}{}r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}{}r} \geq 1} \end{matrix} \right.}$

Case: i>1, j>1; (e)(f)(g)(h); s>0

$\begin{matrix} {{T_{d}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {\left( \left( {{i - 1},{j - 1}} \right) \right){P^{h❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){P^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right),\ \left( {{i + 1},j} \right)} \right)\left( {\left( {{i + 1},{j + 1}} \right),\ \left( {{i + 1},{j + 2}} \right),{\ldots\ \left( {{i + 1},{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{d}{P^{h❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{d}{P^{h❘}({{({i,j})};s})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + h_{d} + \left\{ \begin{matrix} 0 & {{{if}s} = 0} \\ {v_{h} + {\left( {s - 1} \right)v_{v}}} & {{{if}s} \geq 1} \end{matrix} \right.}$

s=0 not valid since we assumed it is greater than 0.

$\begin{matrix} {{T_{h}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {\left( \left( {{i - 1},j} \right) \right){P^{h❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){P^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)\left( {\left( {{i + 1},{j + 1}} \right),\left( {{i + 1},{j + 2}} \right),\ {\ldots\left( {{i + 1},{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{h}{P^{h❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{h}{P^{h❘}({{({i,j})};s})}} = {h + h_{h} + \left\{ \begin{matrix} 0 & {{{if}s} = 0} \\ {v_{h} + {\left( {s - 1} \right)v_{v}}} & {{{if}{}s} \geq 1} \end{matrix} \right.}$

s=0 not valid since we assumed it is greater than 0.

$\begin{matrix} {{T_{v}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {\left( \left( {i,{j - 1}} \right) \right){P^{h❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {i,{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){P^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}}} \\ {= {\left( \left( {i,{j - 1}} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)\left( {\left( {{i + 1},{j + 1}} \right),\left( {{i + 1},{j + 2}} \right),{\ldots\left( {{i + 1},{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{v},{P^{h❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{v},{P^{h❘}({{({i,j})};s})}} = {v + h_{v} + \left\{ \begin{matrix} 0 & {{{if}{}s} = 0} \\ {v_{h} + {\left( {s - 1} \right)v_{v}}} & {{ifs} \geq 1} \end{matrix} \right.}$

s=0 not valid since we assumed it is greater than 0.

$\begin{matrix} {{T_{\phi}{P^{h❘}\left( {\left( {i,j} \right);s} \right)}} = {(\phi){P^{h❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right){p^{❘}\left( {\left( {{i + 1},j} \right);s} \right)}}} \\ {= {\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)\left( {\left( {{i + 1},{j + 1}} \right),\left( {{i + 1},{j + 2}} \right),{\ldots\ \left( {{i + 1},{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{\phi}{P^{h❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},j} \right)},{\left( {{i + 1},j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i + 1},{j + q - 2}} \right)\left( {{i + 1},{j + q - 1}} \right)},{\left( {{i + 1},{j + q - 1}} \right)\left( {{i + 1},{j + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{\phi}{P^{h❘}({{({i,j})};s})}} = {h + \left\{ \begin{matrix} 0 & {{{if}s} = 0} \\ {v_{h} + {\left( {s - 1} \right)v_{v}}} & {{{if}{}s} \geq 1} \end{matrix} \right.}$

s=0 not valid since we assumed it is greater than 0.

Case: i>1, j>1; (i)(j)(k)(l); no r in this case.

${{P^{f}\left( \left( {i,j} \right) \right)}\overset{\Delta}{=}\left( {\left( {i,j} \right),\left( {{i + 1},j} \right)} \right)},{{for}{integers}},{i \geq {0{and}{}j} \geq 0}$ ${T_{d}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{d}\left( {\left( {i,j} \right)\left( {{i + 1},\ j} \right)} \right)}$ $\begin{matrix} {{T_{d}{P^{f}\left( \left( {i,j} \right) \right)}} = {T_{d}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}} \\ {= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( {\left( {i,j} \right)\left( {{i + 1},\ j} \right)} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{d}P^{f_{({({i,i})})}}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)}}$ ${\overset{¯}{S}}_{T_{d}P^{f_{({({i,j})})}}} = {{\kappa\left( {x_{i},y_{i}} \right)} + h_{d}}$ ${T_{h}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{h}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}$ $\begin{matrix} {{T_{h}{P^{f}\left( \left( {i,j} \right) \right)}} = {T_{h}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{h}{P^{f}({({i,i})})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)}}$ ${\overset{¯}{S}}_{T_{h}{P^{f}({({i,i})})}} = {h + h_{h}}$ ${T_{v}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{v}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}$ $\begin{matrix} {{T_{v}{P^{f}\left( \left( {i,j} \right) \right)}} = {T_{v}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}} \\ {= {\left( \left( {i,{j - 1}} \right) \right)\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{v}{P^{f}({({i,i})})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},j} \right)}} \right)}}$ ${\overset{¯}{S}}_{T_{v}{P^{f}({({i,i})})}} = {v + h_{v}}$ ${T_{\phi}{P^{f}\left( \left( {i,j} \right) \right)}}\overset{\Delta}{=}{T_{\phi}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}$ $\begin{matrix} {{T_{\phi}{P^{f}\left( \left( {i,j} \right) \right)}} = {T_{\phi}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}} \\ {= {(\phi)\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}} \\ {= \left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)} \end{matrix}$ ${\overset{¯}{S}}_{T_{\phi},{P^{f}({({i,j})})}} = {{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {{i + 1},j} \right)} \right)}$ ${\overset{¯}{S}}_{T_{\phi},{P^{f}({({i,j})})}} = h$

Case: i>1, j>1; (m); below; r≥1

s = 1 $\begin{matrix} {{T_{\phi}P^{v❘}\left( {\left( {i,j} \right);r} \right)}\overset{\Delta}{=}{(\phi)\left( \left( {i,j} \right) \right)P^{❘}\left( {\left( {i,j} \right);s} \right)}} & (m) \end{matrix}$ T_(ϕ)P^(v❘)((i, j); r = 1) = φ̂₀((i, j)(i, j + 1)) = v Case : i > 1, j > 1; (n)(o)(p)(q); s ≥ 1 ${T_{d}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{{T_{d}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{d}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {T_{d}{P^{v❘}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {\left( {i,{j + 2}} \right),{\ldots\left( {i,{j + s}} \right)}} \right)} \right.}} \end{matrix}$ ${\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {i,{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};s})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {s - 1} \right)v_{v}}}},{{fors} \geq 1.}$ ${T_{h}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{{T_{h}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{h}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {{T_{h}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {i,{j + 2}} \right),{\ldots\left( {i,{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {i,{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};s})}} = {h + v_{h} + {\left( {s - 1} \right)v_{v}}}},{{{for}2} \geq 1.}$ ${T_{v}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{{T_{v}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{v}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {{T_{v}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {i,{j - 1}} \right) \right)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {i,{j - 1}} \right) \right)\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {i,{j + 2}} \right),{\ldots\left( {i,{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,{j - 1}} \right)\left( {i,j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j - 1}} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {i,{j + 1}} \right)}} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};s})}} = {{+ v_{v}} + {\left( {s - 1} \right)v_{v}}}},{{{for}2} \geq 1.}$ ${T_{\phi}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}}\overset{\Delta}{=}{(\phi)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ ${P^{v❘}\left( {\left( {i,j} \right);s} \right)}\overset{\Delta}{=}{\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}$ $\begin{matrix} {{T_{\phi}{P^{v❘}\left( {\left( {i,j} \right);s} \right)}} = {{T_{\phi}\left( \left( {i,j} \right) \right)}{P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {(\phi)\left( \left( {i,j} \right) \right){P^{❘}\left( {\left( {i,j} \right);s} \right)}}} \\ {= {\left( \left( {i,j} \right) \right)\left( {\left( {i,{j + 1}} \right),\left( {i,{j + 2}} \right),{\ldots\left( {i,{j + s}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};s})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {i,j} \right)\left( {i,{j + 1}} \right)} \right)} + {\sum_{q = 2}^{s}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + q - 2}} \right)\left( {i,{j + q - 1}} \right)},{\left( {i,{j + q - 1}} \right)\left( {i,{j + q}} \right)}} \right)}}}$ ${{\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};s})}} = {v + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1}$

Case: i>1, j>1; (r)(s)(t)(u)

$\begin{matrix} {T_{d}\left( \left( {i,j} \right) \right)} & (r) \end{matrix}$ $\begin{matrix} {T_{h}\left( \left( {i,j} \right) \right)} & (s) \end{matrix}$ $\begin{matrix} {T_{v}\left( \left( {i,j} \right) \right)} & (t) \end{matrix}$ $\begin{matrix} {T_{\phi}\left( \left( {i,j} \right) \right)} & (u) \end{matrix}$ ${\overset{\_}{S}}_{T_{d}({({i,j})})} = {\kappa\left( {x_{i},y_{j}} \right)}$ ${\overset{\_}{S}}_{T_{h}({({i,j})})} = h$ ${\overset{\_}{S}}_{T_{v}({({i,j})})} = v$ ${\overset{\_}{S}}_{T_{\phi}({({i,j})})}\overset{\Delta}{=}0$ Case : i > 1, j > 1; (v)(w)(x)(y); r ≥ 0 $\begin{matrix} {{T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (v) \end{matrix}$ $\begin{matrix} {{T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (w) \end{matrix}$ $\begin{matrix} {{T_{v}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{(\phi)\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (x) \end{matrix}$ ${T_{\phi}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{(\phi)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}(y)}$ ${T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}$ $\begin{matrix} {{T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)P^{❘}}}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)} \\ {{= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} {\left( {{i + 1},{j + 1 + 1}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{\_}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\hat{\varphi}}_{0}\left( {\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)},{\left( {{i - 1},j} \right)\left( {i,j} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {i + j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i = 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{\_}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + h_{d} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r + 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}$ $\begin{matrix} {{T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)P^{❘}}}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)} \\ {{= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} {\left( {{i + 1},{j + 2}} \right),\left( {{i + 1},{j + 3}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{\_}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\hat{\varphi}}_{0}\left( {{{\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)}{+ {{{\hat{\varphi}}_{1}\left( {{\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)},{\left( {{i - 1},j} \right)\left( {i,j} \right)}} \right)}{+ {{{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)}{+ {{\hat{\varphi_{1}}\left( \left( {i,j} \right) \right)}\left( {{i + 1},{j + 1}} \right)}}}}}}},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{\_}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + h_{h} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${T_{v}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}$ $\begin{matrix} {{T_{v}T_{v}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}} = {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)P^{❘}}}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)} \\ {{= {\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} {\left( {{i + 1},{j + 2}} \right),\left( {{i + 1},{j + 3}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{\_}{S}}_{T_{v}T_{h}{P^{d❘}({{({i,j})};r})}} = {{{\hat{\varphi}}_{0}\left( {{{\left( {{i - 1},{j - 1}} \right)\left( {{i - 1},j} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},{j - 1}} \right)\left( {{i - 1},j} \right)},{\left( {{i - 1},j} \right)\left( {i,j} \right)}} \right)} + {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)} + {{\hat{\varphi_{1}}\left( \left( {i,j} \right) \right)}\left( {{i + 1},{j + 1}} \right)}},\left( {{i + 1},{j + 1}} \right),\left( {{i + 1},{j + 1 + 1}} \right)} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}}$ ${\overset{\_}{S}}_{T_{v}T_{h}{P^{d❘}({{({i,j})};r})}} = {v + h_{v} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

Not valid in all cases; right angle.

$\begin{matrix} {{T_{\phi}T_{h}{P^{d|}\left( {\left( {i,j} \right);r} \right)}} = {(\phi)\left( \left( {{i - 1},j} \right) \right){P^{d|}\left( {\left( {i,j} \right);r} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right){P^{❘}\left( {\left( {{i + 1},{j + 1}} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 1},j} \right) \right)\left( {\left( {i,j} \right),\left( {{i + 1},{j + 1}} \right)} \right)}}\begin{pmatrix} {\left. {{i + 1},{j + 1 + 1}} \right),\left( {{i + 1},{j + 1 + 2}} \right),} \\ {\ldots\left( {{i + 1},{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{\_}{S}}_{T_{\phi}T_{h}{P^{d❘}({{({i,j})};r})}} = {{\hat{\varphi}}_{0}\left( {{{\left( {{i - 1},j} \right)\left( {i,j} \right)}{+ {{\hat{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,j} \right)},{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)}} \right)}}} + {{\hat{\varphi}}_{1}\left( {{\left( {i,j} \right)\left( {{i + 1},{j + 1}} \right)},{\left( {{i + 1},{j + 1}} \right)\left( {{i + 1},{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\hat{\varphi}}_{1}\left( {{\left( {{i + 1},{j + 1 + q - 2}} \right)\left( {{i + 1},{j + 1 + q - 1}} \right)},{\left( {{i + 1},{j + 1 + q - 1}} \right)\left( {{i + 1},{j + 1 + q}} \right)}} \right)}}} \right.}$ ${\overset{¯}{S}}_{T_{\phi}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

Case: i>1, j>1; AA, BB, CC, and DD; r≥0

$\begin{matrix} {{T_{d}T_{d}{P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{d}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (A) \end{matrix}$ $\begin{matrix} {{T_{h}T_{d}{P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{h}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (B) \end{matrix}$ $\begin{matrix} {{T_{v}T_{d}{P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{v}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (C) \end{matrix}$ $\begin{matrix} {{T_{\phi}T_{d}{P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{\phi}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} & (D) \end{matrix}$ T_(d)T_(d)P^(v|)((i, j + 1); r) = ((i − 2, j − 1))((i − 1, j))((i, j + 1))P^(❘)((i, j + 1); r) $\begin{matrix} {{T_{d}T_{d}{P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}} = {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right){P^{1}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right)\left( \left( {i,{j + 1 + 1}} \right) \right)}}\begin{pmatrix} {\left( {i,{j + 1 + 2}} \right),} \\ {\ldots\left( {i,{j + 1 + r}} \right)} \end{pmatrix}} \end{matrix}$ ${\overset{¯}{S}}_{T_{d}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 2},{j - 1}} \right)\left( {{i - 1},j} \right)},{\left( {i - j} \right)\left( {i,{j + 1}} \right)}} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)},{\left( {i,{j + 1}} \right)\left( {i,{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + 1 + q - 2}} \right)\left( {i,{j + 1 + q - 1}} \right)},{\left( {i,{j + 1 + q - 1}} \right)\left( {i,{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{d}T_{d}{P^{v|}({{({i,{j + 1}})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}r} \geq 1} \end{matrix} \right.}$ T_(h)T_(d)P^(v|)((i, j + 1); r) = ((i − 2, j))((i − 1, j))((i, j + 1))P^(❘)((i, j + 1); r) $\begin{matrix} {{T_{h}T_{d}{P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}} = {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{v|}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right){P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {{= {\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right)\left( \left( {i,{j + 1 + 1}} \right) \right)}}\left( {\left( {i,{j + 1 + 2}} \right),\ {\ldots\left( {i,{j + 1 + r}} \right)}} \right)} \end{matrix}$ ${\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 2},j} \right)\left( {{i - 1},j} \right)},{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)}} \right)} + {{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)},{\left( {i,{j + 1}} \right)\left( {i,{j + 1 + 1}} \right)}} \right)}{\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + 1 + q - 2}} \right)\left( {i,{j + 1 + q - 1}} \right)},{\left( {i,{j + 1 + q - 1}} \right)\left( {i,{j + 1 + q}} \right)}} \right)}}}}$ ${\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {h + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}r} \geq 1} \end{matrix} \right.}$ T_(v)T_(d)P^(v❘)((i, j + 1); r) = T_(v)T_(d)((i, j + 1))P^(❘)((i, j + 1); r)

Not valid in M; produces a right angle.

${T_{\phi}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{\phi}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}$ T_(ϕ)T_(d)P^(v❘)((i, j + 1); r) = (ϕ)((i − 1, j))((i, j + 1))P^(❘)((i, j + 1); r) $\begin{matrix} {{T_{\phi}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}} = {\left( \left( {{i - 1},j} \right) \right){P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right){P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}} \\ {= {\left( \left( {{i - 1},j} \right) \right)\left( \left( {i,{j + 1}} \right) \right)\left( \left( {i,{j + 1 + 1}} \right) \right)\left( {\left( {i,{j + 1 + 2}} \right),\ {\ldots\left( {i,{j + 1 + r}} \right)}} \right)}} \end{matrix}$ ${\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{{\overset{\hat{}}{\varphi}}_{0}\left( {\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)} \right)} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {{i - 1},j} \right)\left( {i,{j + 1}} \right)},{\left( {i,{j + 1}} \right)\left( {i,{j + 1 + 1}} \right)}} \right)} + {\sum_{q = 2}^{r}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i,{j + 1 + q - 2}} \right)\left( {i,{j + 1 + q - 1}} \right)},{\left( {i,{j + 1 + q - 1}} \right)\left( {i,{j + 1 + q}} \right)}} \right)}}}$ ${\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}r} \geq 1} \end{matrix} \right.}$

Step 4) [ρ(A)−Score of W(B)] of all possible walks for ρ(A), and their corresponding W(B).

Difference of score of pairs of pairs: (DP,DQ), (HP,HQ), (VP,VQ), and (FP,FQ)

equivalently pairs: (a)(n), (b)(o), (c)(p), and (d)(q)

for i>1, j>1; r≥0.

${\overset{¯}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};s})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {s - 1} \right)v_{v}}}},{{{for}s} \geq 1.}$ s = r + 1. ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}{}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {rv_{v}}}},{{{for}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{d}}},{{{if}{}r} = 0}$ ${{{\overset{¯}{S}}_{T_{d}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{v}}},{{{if}r} \geq 1}$ ${\overset{¯}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};s})}} = {h + v_{h} + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ s = r + 1 ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}} = {h + v_{h} + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}{}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}} = {h + v_{h} + {rv_{v}}}},{{{for}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{h}}},{{{if}{}r} = 0}$ ${{{\overset{¯}{S}}_{T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + v_{d} - v_{h} - v_{v}}},{{{if}r} \geq 1}$ ${\overset{¯}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} = {v + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};s})}} = {v + v_{v} + {\left( {s - 1} \right)v_{v}}}},{{{for}{}s} \geq 1.}$ s = r + 1 ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}} = {v + v_{v} + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}} = {v + v_{v} + {rv_{v}}}},{{{for}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v_{v}}},{{{if}r} = 0}$ ${{{\overset{¯}{S}}_{T_{v}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{v}{P^{v❘}({{({i,j})};{r + 1}})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + v_{d} - v_{v} - v_{v}}},{{{if}r} \geq 1}$ ${\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {{{if}r} \geq 1} \end{matrix} \right.}$ ${{\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};s})}} = {v + {\left( {s - 1} \right)v_{v}}}},{{{for}s} \geq 1.}$ s = r + 1 ${{\overset{¯}{S}}_{T_{\phi}{P^{v❘}({{({i,j})};{r + 1}})}} = {v + {\left( {r + 1 - 1} \right)v_{v}}}},{{{{for}r} + 1} \geq 1.}$ ${{\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} = {v + {rv_{v}}}},{{{for}{}r} \geq 0.}$ ${{{\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - v}},{{{if}r} = 0}$ ${{{\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{\phi}{P^{d❘}({{({i,j})};r})}}} = {{\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + v_{d} - v - v_{v}}},{{{if}{}r} \geq 1}$

Difference of score of pairs of pairs: (DU,DW), (HU,HW), (VU,VW), and (FU,FW)

equivalently pairs: (e)(n), (f)(o), (g)(p), and (h)(q)

for i>1, j>1; r≥0.

${\overset{¯}{S}}_{T_{d}{P^{h❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + h_{d} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

r=0 not valid since we assumed it is greater than 0.

${{\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i},y_{j}} \right)} + v_{d} + {\left( {r - 1} \right)v_{v}}}},{{{if}r} \geq 1.}$ ${{{\overset{¯}{S}}_{T_{d}{P^{h❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}{P^{v❘}({{({i,j})};r})}}} = {h_{d} + v_{h} - v_{d}}},{{{if}r} \geq 1.}$ ${\overset{¯}{S}}_{T_{h}{P^{h❘}({{({i,j})};r})}} = {h + h_{h} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

r=0 not valid since we assumed it is greater than 0.

${{\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};r})}} = {h + v_{h} + {\left( {r - 1} \right)v_{v}}}},{{{if}{}r} \geq 1.}$ ${{{\overset{¯}{S}}_{T_{h}{P^{h❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}{P^{v❘}({{({i,j})};r})}}} = h_{h}},{{{if}r} \geq 1.}$ ${\overset{¯}{S}}_{T_{v}{P^{h❘}({{({i,j})};r})}} = {v + h_{v} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

r=0 not valid since we assumed it is greater than 0.

${{\overset{\_}{S}}_{T_{v}{P^{v❘}({{({i,j})};r})}} = {v + v_{v} + {\left( {r - 1} \right)v_{v}}}},{{{if}{}r} \geq 1.}$ ${{\overset{\_}{S}}_{T_{v}{P^{h❘}({{({i,j})};r})}} - {\overset{\_}{S}}_{T_{v}{P^{v❘}({{({i,j})};r})}}} = {h_{v} + v_{h} - v_{v}}$ ${\overset{¯}{S}}_{T_{\phi}{P^{h|}({{({i,j})};r})}} = {h + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{h} + {\left( {r - 1} \right)v_{v}}} & {{{if}{}r} \geq 1} \end{matrix} \right.}$

r=0 not valid since we assumed it is greater than 0. S _(T) _(ϕ) _(P) _(v|) _(((i,j);r)) =v+(r−1)v _(v), for r≥1. S _(T) _(ϕ) _(P) _(h|) _(((i,j);r)) −S _(T) _(ϕ) _(P) _(v|) _(((i,j);r)) =h+v _(h) −v, if r≥1

Difference of score of pairs of pairs: (DX,D), (HX,H), (VX,V), and (FX,F)

equivalently pairs: (i)(r), (j)(s), (k)(t), and (l)(u)

for i>1, j>1 S _(T) _(d) _(P) _(f) _((i,j))=κ(x _(i) ,y _(j))+h _(d) ρ(i,j)≥ S _(T) _(d) _(((i,j)))=κ(x _(i) ,y _(j)) S _(T) _(d) _(P) _(f) _((i,j))−ρ(i,j)≤κ(x _(i) ,y _(j))+h _(d)−κ(x _(i) ,y _(j))=h _(d) S _(T) _(d) _(P) _(f) _((i,j))−ρ(i,j)≤h _(d) S _(T) _(h) _(P) _(f) _((i,j)) =h+h _(h) ρ(i,j)≥ S _(T) _(h) _(((i,j))) =h S _(T) _(h) _(P) _(f) _((i,j))−ρ(i,j)h+h _(h) −h=h _(h) S _(T) _(h) _(P) _(f) _((i,j))−ρ(i,j)≤h _(h) S _(T) _(v) _(P) _(f) _((i,j)) =v+h _(v) ρ(i,j)≥ S _(T) _(v) _(((i,j))) =v S _(T) _(v) _(P) _(f) _((i,j))−ρ(i,j)≤v+h _(v) −v=h _(v) S _(T) _(v) _(P) _(f) _((i,j))−ρ(i,j)≤h _(v) S _(T) _(ϕ) _(P) _(f) _((i,j)) =h ρ(i,j)≥ S _(T) _(d) _(P) _(f) _((i,j))

S _(T) _(ϕ) _(P) _(f) _((i,j))−ρ(i,j)≤h−0 S _(T) _(ϕ) _(P) _(f) _((i,j))−ρ(i,j)≤h

Difference of score of pairs of pairs: (DHP,DDQ′), (HHP,HDQ′), (VHP,VDQ′), and (FHP,FDQ′)

equivalently pairs: (v)(AA), (w)(BB), (x)(CC), and (y)(DD)

i > 1, j > 1; r ≥ 0; $\begin{matrix} {{T_{d}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (v) \end{matrix}$ $\begin{matrix} {{T_{h}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 2},j} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (w) \end{matrix}$ $\begin{matrix} {{T_{v}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{\left( \left( {{i - 1},{j - 1}} \right) \right)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (x) \end{matrix}$ $\begin{matrix} {{T_{\phi}T_{h}{P^{d❘}\left( {\left( {i,j} \right);r} \right)}}\overset{\Delta}{=}{(\phi)\left( \left( {{i - 1},j} \right) \right){P^{d❘}\left( {\left( {i,j} \right);r} \right)}}} & (y) \end{matrix}$ ${\overset{¯}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + h_{d} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${\overset{¯}{S}}_{T_{d}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{\kappa\left( {x_{i - 1},y_{j}} \right)} + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{{\overset{¯}{S}}_{T_{d}T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{d}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}}} = {h_{d} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - {\kappa\left( {x_{i},y_{j + 1}} \right)}}},{{{for}{}r} \geq 0.}$ ${\overset{¯}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + h_{h} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {h + {\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {{{if}r} = 0} \\ {v_{d} + {\left( {r + 1} \right)v_{v}}} & {{{if}r} \geq 1} \end{matrix} \right.}$ ${{{\overset{¯}{S}}_{T_{h}T_{h}{P^{d❘}({{({i,j})};r})}} - {\overset{¯}{S}}_{T_{h}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}}} = {h_{h} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - {\kappa\left( {x_{i},y_{j + 1}} \right)}}},{{{for}{}r} \geq 0}$ ${\overset{¯}{S}}_{T_{v}T_{h}{P^{d❘}({{({i,j})};r})}} = {v + h_{v} + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r + 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

Not valid in M; v followed by h!

${T_{v}T_{d}{P^{v❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}\overset{\Delta}{=}{T_{v}{T_{d}\left( \left( {i,{j + 1}} \right) \right)}{P^{❘}\left( {\left( {i,{j + 1}} \right);r} \right)}}$ ${\overset{¯}{S}}_{T_{\phi}T_{h}{P^{d❘}({{({i,j})};r})}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r - 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$

Not valid overlapping alignment.

${\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}} = {{\kappa\left( {x_{i},y_{j + 1}} \right)} + \left\{ \begin{matrix} 0 & {r = 0} \\ {v_{d} + {\left( {r + 1} \right)v_{v}}} & {r \geq 1} \end{matrix} \right.}$ ${{{\overset{¯}{S}}_{T_{\phi}T_{h}P^{d❘_{({{({i,j})};r})}}} - {\overset{¯}{S}}_{T_{\phi}T_{d}{P^{v❘}({{({i,{j + 1}})};r})}}} = {h + {\kappa\left( {x_{i + 1},y_{j + 1}} \right)} - {\kappa\left( {x_{i},y_{j + 1}} \right)}}},{{{for}{}r} \geq 0}$

Step 5) Tabulation of all possible ρ(A)−Score of W(B)

We extend the above results for all valid (i,j) and tabulate the results below.

For AS

R > 1 R = 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 C ≥ 2 C = 2 C > 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 i = R and j = C 1 & 2 3 4 5 6 7 8 9 10 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = NO NO NO NO DQ κ(x_(i+1), y_(j+1)) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v), if r ≥ 1 2 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) = NO NO NO NO NO NO HQ κ(x_(i+1), y_(j+1)) − v_(h), if r = 0 S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(h) + v_(d) − v_(v), if r ≥ 1 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = NO NO NO NO NO NO NO VQ κ(x_(i+1), y_(j+1)) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = X X X FQ κ(x_(i+1), y_(j+1)) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ(x_(i+1), y_(j+1)) + v_(d) − v − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = X X X X X X X DQ′ κ(x_(i+1), y_(j+1)) − κ(x_(i), y_(j+1)) 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = X X X X X X X X Q″ κ(x_(i+1), y_(j+1)) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ(x_(i+1), y_(j+1)) + v_(d) + (r − 1)v_(v) − v, if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h) NO NO NO NO NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO NO NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h F 13 FY ρ(A) − ρ(B) ≤ 0 NO NO FQ″ 1 3 4 5 6 7 8 9 10

Here we note S _(T) _(ϕ) _((0, 0))=ρ(0,0)=0.

For M

M follows AS except in row index 2. The (R,C) values that have NO in row index 2 do not have a valid walk for ρ(A), so they are ignored. But the (R,C) values that have X in row index 2 need a new walk for B since the one used for AS is not valid for M. For these (R,C)'s, we give a valid walk in the next table.

R > 1 R = 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 C ≥ 2 C = 2 C > 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 i = R and j = C 1 & 2 3 4 5 6 7 8 9 10 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = NO NO NO NO DQ κ(x_(i+1), y_(j+1)) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v), if r ≥ 1 2 HP see table below X X X X X NO X X NO HQ 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = NO NO NO NO NO NO NO VQ κ(x_(i+1), y_(j+1)) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = κ(x_(i+1), y_(j+1)) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = FQ κ(x_(i+1), y_(j+1)) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ(x_(i+1), y_(j+1)) + v_(d) − v − v_(v), if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h) NO NO NO NO NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO NO NO NO NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h F 13 FY S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h NO NO NO NO NO NO NO NO NO FQ″

Below, bold font pairs are not valid in M, but the regular font pairs are valid; their score differences are given in the last column. The regular font pairs use a new walks for B, which are valid in M.

Underbar means not valid for AS, as well.

01 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R > 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C = 2 DHP DDQ′ HHP HDQ′ VHP VDQ′ FHP FDQ′ 02 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R > 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(h) + κ(x_(i+1), y_(j+1)) − DDQ′ κ(x_(i), y_(j+1)), for r ≥ 0 HHP HDQ′ VHP VDQ′ FHP FDQ′ 03 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R = 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C = 2 DHP DDQ′ HHP HDQ′ VHP VDQ′ FHP FDQ′ 04 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(d) + κ(x_(i+1), y_(j+1)) − R = 1 HQ κ(x_(i), y_(j+1)), for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h_(h) + κ(x_(i+1), y_(j+1)) − DDQ′ κ(x_(i), y_(j+1)), for r ≥ 0 HHP HDQ′ VHP VDQ′ FHP FDQ′ 05 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j+1); r)) = h + κ(x_(i+1), y_(j+1)) − R > 1 HQ κ(x_(i), y_(j+1)), if r ≥ 0 C = 1 HP DQ′ 06 HP R = 1 HQ C = 1 07 HP R > 0 HQ C = 0 08 HP R = 0 HQ C > 1 09 HP R = 0 HQ C = 1 10 HP R = 0 HQ C = 0

Step 6) An overall upper bound for ρ(A)−Score of W(B) for affine, simplified and modified gap scores.

Next, we maximize the upper bounds in the tables of step 5) using κ_(max), and κ_(min), where κ_(max)=max (κ(x_(i),y_(j))) and κ_(min)=min (κ(x_(i),y_(j))).

For AS:

R > 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 i = R and j = C C ≥ 2 C ≥ 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO NO NO DQ κ_(max) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v), if r ≥ 1 2 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO HQ κ_(max) − v_(h), if r = 0 S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(h) + v_(d) − v_(v), if r ≥ 1 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO NO VQ κ_(max) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ NO NO NO NO NO NO NO FQ κ_(max) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ κ_(max) + v_(d) − v − v_(v), if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h) NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h NO NO NO NO NO NO NO F

For M:

R > 1 R = 1 R > 1 R = 1 R > 0 R = 0 R = 0 R = 0 i = R and j = C C ≥ 2 C ≥ 2 C = 1 C = 1 C = 0 C > 1 C = 1 C = 0 1 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ NO NO NO NO DQ κ_(max) − v_(d), if r = 0 S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v), if r ≥ 1 2 HP see table below X X X X NO X X NO HQ 3 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤

NO NO NO VQ κ_(max) − v_(v), if r = 0 S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) ≤ κ_(max) − v_(v) + v_(d) − v_(v), if r ≥ 1 4 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ NO NO NO NO NO NO NO FQ κ_(max) − v, if r = 0 S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) ≤ κ_(max) + v_(d) − v − v_(v), if r ≥ 1 5 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO DW h_(d) + v_(h) − v_(d), if r ≥ 1. 6 HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO HW h_(h), if r ≥ 1. 7 VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO VW h_(v) + v_(h) − v_(v) if r ≥ 1. 8 FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = NO NO NO NO NO NO NO NO FW h + v_(h) − v, if r ≥ 1 9 DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) NO NO NO NO D 10 HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h)

NO NO NO H 11 VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) NO NO NO NO NO NO NO NO V 12 FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h NO NO NO NO NO NO NO F

M: continues

01 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R > 1 HQ for r ≥ 0. C = 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), DDQ′ for r ≥ 0. HHP HDQ′ VHP XXX 02 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R > 1 HQ for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), DDQ′ for r ≥ 0 HHP HDQ′ VHP XXX 03 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R = 1 HQ for r ≥ 0. C = 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), DDQ′ for r ≥ 0. HHP HDQ′ VHP XXX 04 HP S _(T) _(d) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(d) + κ_(max) − κ_(min), R = 1 HQ for r ≥ 0. C > 2 DHP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), DDQ′ for r ≥ 0 HHP HDQ′ VHP XXX 05 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h + κ_(max) − κ_(min), R > 1 HQ if r ≥ 0 C = 1 HP DQ′ 06 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h + κ_(max) − κ_(min), R = 1 HQ if r ≥ 0 C = 1 HP DQ′ 07 HP HP R > 0 HQ HQ C = 0 08 HP S _(T) _(h) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h_(h) + κ_(max) − κ_(min), R = 0 HQ for r ≥ 0 C > 1 DHP DDQ′ HHP HDQ′ VHP XXX 09 HP S _(T) _(ϕ) _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(T) _(d) _(P) _(v|) _(((i, j+1); r)) ≤ h + κ_(max) − κ_(min), R = 0 HQ for r ≥ 0 C = 1 DHP DDQ′ HHP HDQ′ VHP XXX FHP FDQ′ 10 HP HP R = 0 HQ HQ C = 0

Next, we find an upper bound to ρ(A)−ρ(B) using the above tables, and the inequality ρ(A)−ρ(B)≤S _(T) _(d) _(P) _(d|) _(((i,j);r))−S _(T) _(d) _(P) _(v|) _(((i,j);r+1)).

For AS

R > 1 i = R and j = C C = 2 DP S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = κ_(max) − v_(d), if r = 0 DQ S _(T) _(d) _(P) _(d|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r+1)) = κ_(max) − v_(v), if r ≥ 1 HP S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) = κ_(max) − v_(h), if r = 0 HQ S _(T) _(h) _(P) _(d|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r+1)) = κ_(max) − v_(h) + v_(d) − v_(v), if r ≥ 1 VP S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = κ_(max) − v_(v), if r = 0 VQ S _(T) _(v) _(P) _(d|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r+1)) = κ_(max) − v_(v) + v_(d) − v_(v), if r ≥ 1 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ_(max) − v, if r = 0 FQ S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ_(max) + v_(d) − v − v_(v), if r ≥ 1 FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ_(max) − κ_(min) DQ′ FP S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ_(max) − v, if r = 0 Q″ S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(d|) _(((i, j); r)) = κ_(max) + v_(d) + (r − 1)v_(v) − v, if r ≥ 1 DU S _(T) _(d) _(P) _(h|) _(((i, j); r)) − S _(T) _(d) _(P) _(v|) _(((i, j); r)) = h_(d) + v_(h) − v_(d), if r ≥ 1. DW HU S _(T) _(h) _(P) _(h|) _(((i, j); r)) − S _(T) _(h) _(P) _(v|) _(((i, j); r)) = h_(h), if r ≥ 1. HW VU S _(T) _(v) _(P) _(h|) _(((i, j); r)) − S _(T) _(v) _(P) _(v|) _(((i, j); r)) = h_(v) + v_(h) − v_(v) if r ≥ 1. VW FU S _(T) _(ϕ) _(P) _(h|) _(((i, j); r)) − S _(T) _(ϕ) _(P) _(v|) _(((i, j); r)) = h + v_(h) − v, if r ≥ 1. NO FW DX S _(T) _(d) _(P) _(f) _((i, j)) − S _(T) _(d) _((i, j)) ≤ h_(d) D HX S _(T) _(h) _(P) _(f) _((i, j)) − S _(T) _(h) _((i, j)) ≤ h_(h) H VX S _(T) _(v) _(P) _(f) _((i, j)) − S _(T) _(v) _((i, j)) ≤ h_(v) V FX S _(T) _(ϕ) _(P) _(f) _((0, 0)) − S _(T) _(ϕ) _((0, 0)) ≤ h F FY ρ(A) − ρ(B) ≤ 0 FQ″

Therefore, ρ(A)−ρ(B)≤max {κ_(max)+α+β,0}

For M: ρ(A)−ρ(B)≤max{κ_(max)+α+β,−β,−β+κ_(max)−κ_(min)}

Step 7) Upper bounds when κ_(min)≤0 and κ_(max)≥0

Local Alignment

affine modified simplified Lemma 1.3 −α − β min{−α − β, κ_(min) + β} −α − β lower bound Lemma 1.3 max{κ_(max) + max{κ_(max) + α + {κ_(max) + α + upper bound α + β, 0} β, −β, −β + κ_(max) − κ_(min)} β, 0}

C. Lemma 2.3 Lower Bound

We are given vertices C=(i,j) and A=(i,j+1), where ρ(C) denotes the best score from (0,0) to C, and σ(A) denotes the best score from (i₀,j₀) to A, over walks ending with a vertical arc. This lemma shows, 0≤ρ(C)−σ(A), for AS and M gap scores.

Proof:

1. Case 1) C≠(0,0)

We have A=C+(0,1), thus A≠(0,0), thus it has a W_(σ(A)). W _(σ(A))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s) ,j _(s))), for s≥1 W _(σ(A))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s−1) ,j _(s−1)+1)), for s≥1

Subcase 1.a) s=1

Not feasible for Case 1).

Subcase 1.b) s>1 W _(σ(A))

(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s−1) ,j _(s−1)+1)), for s>1 W _(σ(A)) ={acute over (W)} _(σ(A))((i _(s−1) ,j _(s−1)))*((i _(s−1) ,j _(s−1)+1))

if W_(σ(A)) belongs to M clearly so does {acute over (W)}_(σ(A))(i_(s−1),j_(s−1))).

$\begin{matrix} {{\sigma(A)} = {\overset{¯}{S}}_{W_{\sigma(A)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\sigma(A)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}} \end{matrix}$ ${\rho(C)} \geq {\overset{¯}{S}}_{{\overset{'}{W}}_{\sigma(A)}({({i_{s - 1},j_{s - 1}})})}$ ${{\rho(C)} - {\sigma(A)}} \geq {- {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}$ ρ(C) − σ(A) ≥ 0.

This also holds for banded case.

Let {circumflex over (σ)}(A) denote a best path in the band, reaching A with last arc vertical, and let ρ(C) denote a best path in the band, reaching C.

Now, if A and C are in the band, then the above argument works when we replace σ(A) and ρ(C) with {circumflex over (σ)}(A) and {circumflex over (ρ)}(C), respectively. W _({circumflex over (σ)}(A))

(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s−1) ,j _(s−1)+1)), for s>1 W _({circumflex over (σ)}(A)) ={acute over (W)} _(σ(A))((i _(s−1) ,j _(s−1)))*((i _(s−1) ,j _(s−1)+1))

if W_({circumflex over (σ)}(A)) belongs to M clearly so does {acute over (W)}_({circumflex over (σ)}(A))((i_(s−1),j_(s−1))).

if W_({circumflex over (σ)}(A)) belongs to the band, and C belongs to the band, then so does {acute over (W)}_({circumflex over (σ)}(A))((i_(s−1),j_(s−1)).

$\begin{matrix} {{\overset{\hat{}}{\sigma}(A)} = {\overset{¯}{S}}_{W_{\hat{\sigma}(A)}}} \\ {= {{\overset{¯}{S}}_{{\overset{'}{W}}_{\hat{\sigma}(A)}({({i_{s - 1},j_{s - 1}})})} + {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}} \end{matrix}$ ${\overset{\hat{}}{\rho}(C)} \geq {\overset{¯}{S}}_{{\overset{'}{W}}_{\hat{\sigma}(A)}({({i_{s - 1},j_{s - 1}})})}$ ${{\overset{\hat{}}{\rho}(C)} - {\overset{\hat{}}{\sigma}(A)}} \geq {- {{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 2},j_{s - 2}} \right)\left( {i_{s - 1},j_{s - 1}} \right)},{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s - 1},{j_{s - 1} + 1}} \right)}} \right)}}$ ${{\overset{\hat{}}{\rho}(C)} - {\overset{\hat{}}{\sigma}(A)}} \geq {0.}$

Case 2) C=(0,0)

We have ρ(C)=0 by definition. A=(0,1) σ(A)=v ρ(C)−σ(A)=0−v ρ(C)−σ(A)>0.

Again, the above argument works when we replace σ(A) and ρ(C) with {circumflex over (σ)}(A) and {circumflex over (ρ)}(C), respectively.

affine modified simplified Lemma 1.3 −α − β min{−α − β, κ_(min) + β} −α − β lower bound Lemma 1.3 max{κ_(max) + max{κ_(max) + α + {κ_(max) + α + upper bound α + β, 0} β, −β, −β + κ_(max) − κ_(min)} β, 0} Local Alignment Local Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 1.3 −α − β min{−α − β, κ_(min) + β} −α − β lower bound Lemma 1.3 κ_(max) + α + β max{κ_(max) + α + β, −β + κ_(max) + α + β upper bound κ_(max) − κ_(min)} Local Alignment:

affine modified simplified Lemma 2.3 0 0 0 lower bound Lemma 2.3 upper bound Local Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 2.3 0 0 0 lower bound Lemma 2.3 upper bound

D. Lemma 2.3 Upper Bound

We are given vertices C=(i,j) and A=(i,j+1), where ρ(C) denotes the best score from (i₀,j₀) to C, and σ(A) denotes the best score from (i₀,j₀) to A, over walks ending with a vertical arc. This lemma shows, ρ(C)−σ(A)≤α+β, for AS and ρ(C)−σ(A)≤max{0,α+β, κ_(max)−κ_(min)+(α+β), κ_(max)−2κ_(min)+α−β}, for M gap scores.

Proof:

For AS:

1. Case 1) C≠(0,0)

We have A=C+(0,1), thus A≠(0,0).

Since C≠(0,0), we have W_(ρ(C))

((i₀,j₀), (i₁,j₁), . . . , (i_(s−1),j_(s−1)) (i_(s),j_(s))) for s≥1.

Define W

W_(ρ(C))*((i_(s),j_(s)+1))

$\begin{matrix} {{\sigma(A)} \geq {\overset{\_}{S}}_{W}} \\ {= {\overset{\_}{S}}_{W_{\rho(C)}*{({({i_{s},{j_{s} + 1}})})}}} \\ {= {{\overset{¯}{S}}_{W_{\rho(C)} +}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)},{\left( {i_{s},j_{s}} \right)\left( {i_{s},{j_{s} + 1}} \right)}} \right)}}} \\ {= {{\rho(C)} + v_{u}}} \end{matrix}$

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(h), then u=h.

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(v), then u=v. ρ(C)−σ(A)≤−v _(u).

2. Case 2) C=(0,0)

We have ρ(C)=0 by definition. A=(0,1) σ(A)=v ρ(C)−σ(A)=0−v ρ(C)−σ(A)=−v.

Therefore, ρ(C)−σ(A)≤α+β.

Now, if A and C are in a band, then the above argument works when we replace σ(A) and ρ(C) with {circumflex over (σ)}(A) and {circumflex over (ρ)}(C), respectively. More specifically, if C and A belong to the band, so do:

1) arc from C to A, and

2) S _(W) _(ρ(C)) _(*((i) _(s) _(,j) _(s) ₊₁₎₎

And the argument holds.

For M:

Case 1) C≠(0,0)

We have A=C+(0,1), thus A≠(0,0). Since C≠(0,0), we have W_(ρ(C))

((i₀,j₀), (i₁,j₁), . . . , (i_(s−1),j_(s−1)), (i_(s),j_(s)), for s≥1. Subcase 1.a) (i_(s−1),j_(s−1))(i_(s),j_(s))∉A^(h)

Define W

W_(ρ(C))*(i_(s),j_(s)+1)). Claim walk W does not have a horizontal arc followed by a vertical. Follows from 1) W_(ρ(C)) does not have a horizontal arc followed by a vertical, and 2) from 1.a) the assumption.

$\begin{matrix} {{\sigma(A)} \geq {\overset{\_}{S}}_{W}} \\ {= {\overset{\_}{S}}_{W_{\rho(C)}*{({({i_{s},{j_{s} + 1}})})}}} \\ {= {{\overset{¯}{S}}_{W_{\rho(C)} +}{{\overset{\hat{}}{\varphi}}_{1}\left( {{\left( {i_{s - 1},j_{s - 1}} \right)\left( {i_{s},j_{s}} \right)},{\left( {i_{s},j_{s}} \right)\left( {i_{s},{j_{s} + 1}} \right)}} \right)}}} \\ {= {{\rho(C)} + v_{u}}} \end{matrix}$

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(d), then u=d.

If (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(v), then u=v.

We note (i_(s−1),j_(s−1))(i_(s),j_(s))∉A^(h) because of the 1.a) assumption. ρ(C)−σ(A)≤−v _(u)

Subcase 1.b) (i_(s−1),j_(s−1))(i_(s),j_(s))∈A^(h)

Sub-subcase 1.b.a) s=1 W _(ρ(C))=((i ₀ ,j ₀),(i ₀+1,j ₀)) ρ(C)= S _(W) _(ρ(C)) ={circumflex over (φ)}₀((i ₀ ,j ₀),(i ₀+1,j ₀))=h W ₁

(i _(s) ,j _(s))(i _(s) ,j _(s)+1) σ(A)≥ S _(W) ₁ ={circumflex over (φ)}₀((i _(s) ,j _(s)),(i _(s) ,j _(s)+1))=v ρ(C)−σ(A)≤h−v

Sub-subcase 1.b.a) s>1 W _(ρ(C))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1)),(i _(s) ,j _(s))), for s>1 i _(s) =i _(s−1)+1 j _(s) =j _(s−1)

Based on Lemma WT, there is an integer p,

0≤p≤s−2, such that for W _(ρ(C))=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p+1) ,j _(p+1)), . . . ,(i _(s−1) ,j _(s)),(i _(s) ,j _(s)))

we have i_(q+1)=i_(q)+1, for p≤q≤s−1,j_(p+1)=j_(p)+1, and j_(q+1)=j_(q), for p+1≤q≤s−1. Thus, W_(ρ(C))=((i₀,j₀), . . . , (i_(p),j_(p)), (i_(p)+1,j_(p)+1), (i_(p)+2,j_(p)+1), . . . , (i_(p)+s−1,j_(p)+1), (i_(p)+s,j_(p)+1))

We define W=((i₀,j₀), . . . , (i_(p),j_(p)), (i_(p)+1,j_(p)+1−1), (i_(p)+2,j_(p)+1−1), . . . , (i_(p)+s−1,j_(p)+1−1), (i_(p)+s,j_(p)+1))*((i_(p)+s,j_(p)+2)) ρ(C)= S _(W) _(ρ(C)) ·σ(A)≥ S _(W)·ρ(C)−σ(A)≤ S _(W) _(ρ(C)) −S _(W)

Part 1) p=0 W _(ρ(C))=((i ₀ ,j ₀),(i ₀+1,j ₀+1),(i ₀+2,j ₀+1), . . . ,(i ₀ +s−1,j ₀+1),(i ₀ +s,j ₀+1)) S _(W) _(ρ(C)) ={circumflex over (φ)}₀((i ₀ ,j ₀),(i ₀+1,j ₀+1))+{circumflex over (φ)}₁((i ₀ ,j ₀)(i ₀+1,j ₀+1),(i ₀+1,j ₀+1)(i ₀+2,j ₀+1))+Σ_(l=3) ^(s)φ₁(i ₀ +l−2,j ₀+1)(i ₀ +l−1,j ₀+1),(i ₀ +l−1,j ₀+1)(i ₀ +l,j ₀+1)) S _(W) _(ρ(C)) =κ(x _(i) ₀ ₊₁ ,y _(j) ₀ ₊₁)+h _(d)+(s−2)h _(h) W=((i ₀ ,j ₀),(i ₀+1,j ₀+1−1),(i ₀+2,j ₀+1−1), . . . ,(i ₀ +s−1,j ₀+1−1),(i ₀ +s,j ₀+1))*((i _(p) +s,j _(p)+2)) S _(W)={circumflex over (φ)}₀((i ₀ ,j ₀),(i ₀+1,j ₀+1−1))+Σ_(l=2) ^(s−1){circumflex over (φ)}₁((i ₀ +l−2,j ₀)(i ₀ +l−2+1,j ₀+1−1),(i ₀ +l−2+1,j ₀+1−1)(i ₀ +l−2+2,j ₀+1−1))+{circumflex over (φ)}₁((i ₀ +s−2,j ₀)(i ₀ +s−2+1,j ₀+1−1),(i ₀ +s−2+1,j ₀+1−1)(i ₀ +s−2+2,j ₀+1))+{circumflex over (φ)}₁((i ₀ +s−2+1,j ₀+1−1)(i ₀ +s−2+2,j ₀+1),(i ₀ +s−2+2,j ₀+1)(i ₀ +s−2+2,j ₀+2)) S _(W) =h+(s−2)h _(h)+κ(x _(i) ₀ _(+s) ,y _(j) ₀ ₊₁)+v _(d) ρ(C)−σ(A)≤ S _(Wρ(C)) −S _(W)≤κ(x _(i) ₀ ₊₁ ,y _(j) ₀ ₊₁)+h _(d)+(s−2)h _(h)−(h+(s−2)h _(h)+κ(x _(i) ₀ _(+s) ,y _(j) ₀ ₊₁)+v _(d)) ρ(C)−σ(A)≤κ(x _(i) ₀ ₊₁ ,y _(j) ₀ ₊₁)+h _(d) −h−κ(x _(i) ₀ _(+s) ,y _(j) ₀ ₊₁)−v _(d)

Part 2) p>0 AND (i_(p−1),j_(p−1))(i_(p),j_(p))∉A^(v) W _(ρ(A))((i _(l) ,j _(l)))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l))), for 0≤l≤t. W _(ρ(C))=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1))={acute over (W)} _(ρ(C))((i _(p) ,j _(p)))*((i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1)) S _(W) _(ρ) _((c)) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+{circumflex over (φ)}₁(i _(p−1) ,j _(p−1))(i _(p) ,j _(p)),(i _(p) ,j _(p))(i _(p)+1,j _(p)+1))+{circumflex over (φ)}₁((i _(p) ,j _(p))(i _(p)+1,j _(p)+1),(i _(p)+1,j _(p)+1)(i _(p)+2,j _(p)+1))+Σ_(l=3) ^(s){circumflex over (φ)}₁((i _(p) +l−2,j _(p)+1)(i _(p) +l−1,j _(p)+1),(i _(p) +l−1,j _(p)+1)(i _(p) +l,j _(p)+1)) S _(Wρ(C)) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h) W=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1−1),(i _(p)+2,j _(p)+1−1), . . . ,(i _(p) +s−1,j _(p)+1−1),(i _(p) +s,j _(p)+1))*((i _(p) +s,j _(p)+2))={acute over (W)} _(ρ(C))((i _(p) ,j _(p)))*((i _(p)+1,j _(p)+1−1),(i+2,j _(p)+1−1), . . . ,(i _(p) +s−1,j _(p)+1−1),(i _(p) +s,j _(p)+1))*((i _(p) +s,j _(p)+2)) S _(W) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+{circumflex over (φ)}₁((i _(p−1) ,j _(p−1))(i _(p) ,j _(p)),(i _(p) ,j _(p))(i _(p)+1,j _(p)))+Σ_(l=2) ^(s−1){circumflex over (φ)}₁((i _(p) +l−2,j _(p))(i _(p) +l−2+1,j _(p)+1−1),(i _(p) +l−2+1,j _(p)+1−1(i _(p) +l−2+2,j _(p)+1−1))+{circumflex over (φ)}₁((i _(p) +s−2,j _(p))(i _(p) +s−2+1,j _(p)+1−1),(i _(p) +s−2+1,j _(p)+1−1)(i _(p) +s−2+2,j _(p)+1))+{circumflex over (φ)}₁((i _(p) +s−2+1,j _(p)+1−1)(i _(p) +s−2+2,j _(p)+1),(i _(p) +s−2+2,j+1)(i _(p) +s−2+2,j _(p)+2)) S _(W) =S _({acute over (W)}) _(ρ(C)) _((i) _(p) _(,j) _(p) ₎₎ +h _(u)+(s−2)h _(h)+κ(x _(i) _(p) _(s) ,y _(j) _(p) ₊₁)+v _(d)

If (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(d), then u=d.

If (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(h), then u=h.

(If (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(v), then u=v) this does not occur because of the assumption of part 2. ρ(C)−σ(A)≤ S _(W) _(ρ(C)) −S _(W) ≤S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h)−( S _({acute over (W)}) _(ρ(C)) _(((i) _(p) _(,j) _(p) ₎₎ +h _(u)+(s−2)h _(h)+κ(x _(i) _(p) _(s) ,y _(j) _(p) ₊₁)+v _(d) ρ(C)−σ(A)≤κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d) −h _(u)−κ(x _(i) _(p) _(+s) ,y _(j) _(p) ₊₁)−v _(d)

Part 3) p>0 AND (i_(p−1),j_(p−1))(i_(p),j_(p))∈A^(v) {acute over (W)} _(ρ(C))((i _(l) ,j _(l)))

((i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(l) ,j _(l))), for 0≤l≤t.

The arc (i_(p−1),j_(p−1)) (i_(p),j_(p)) is not the first arc of W_(ρ(C)) because of Lemma WT. Hence, p>1. W _(ρ(C))=((i ₀ ,j ₀), . . . ,(i _(p) ,j _(p)),(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1))={acute over (W)} _(ρ(C))((i _(p−1) ,j _(p−1)))*((i _(p) ,j _(p))(i _(p)+1,j _(p)+1),(i _(p)+2,j _(p)+1), . . . ,(i _(p) +s−1,j _(p)+1),(i _(p) +s,j _(p)+1))

Since p>1, we have S _(W) _(ρ(C)) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p−1) _(,j) ⁻¹ ₎₎+{circumflex over (φ)}₁((i _(p−2) ,j _(p−2))(i _(p−1) ,j _(p−)),(i _(p−1) ,j _(p−1))(i _(p) ,j _(p)))+{circumflex over (φ)}₁((i _(p−1) ,j _(p−1))(i _(p) ,j _(p)),(i _(p) ,j _(p))(i _(p)+1,j _(p)+1))+{circumflex over (φ)}₁((i _(p) ,j _(p))(i _(p)+1,j _(p)+1),(i _(p)+1,j _(p)+1(i _(p)+2,j _(p)+1))+Σ_(l=3) ^(s){circumflex over (φ)}₁((i _(p) +l−2,j _(p)+1)(i _(p) +l−1,j _(p)+1),(i+l−1,j _(p)+1)(i _(p) +l,j _(p)+1)) S _(W) _(ρ(C)) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎ +v _(u)+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h)

If (i_(p−2),j_(p−2))(i_(p−1),j_(p−1))∈A^(d), then u=d. If (i_(p−2),j_(p−2))(i_(p−1),j_(p−1))∈A^(h), then u=h. If (i_(p−2),j_(p−2))(i_(p−1),j_(p−1))∈A^(v), then u=v.

u=h this does not occur because W_(ρ(C)) does not have a horizontal arc followed by a vertical arc due to M. W=((i ₀ ,j ₀), . . . ,(i _(p−1) ,j _(p−1)),(i _(p)+1,j _(p)),(i _(p)+2,j _(p)),(i _(p)+3,j _(p)), . . . ,(i _(p) +s−1,j _(p)),(i _(p) +s,j _(p)+1))*((i _(p) +s,j _(p)+2))={acute over (W)} _(ρ(C))((i _(p−1) ,j _(p−1)))*((i _(p)+1,j _(p)),(i _(p)+2,j _(p)), . . . ,(i _(p) +s−1,j _(p)),(i _(p) +s,j _(p)+1))*((i _(p) +s,j _(p)+2)) S _(W) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎+{circumflex over (φ)}₁((i _(p−2) ,j _(p−2))(i _(p−1) ,j _(p−1)),(i _(p−1) ,j _(p−1))(i _(p)+1,j _(p))+{circumflex over (φ)}₁((i _(p−1) ,j _(p−1))(i _(p)+1,j _(p)),(i _(p)+1,j _(p))(i _(p)+2,j _(p)))+Σ_(l=3) ^(s−1){circumflex over (φ)}₁((i _(p) +l−2,j _(p))(i _(p)+1−1,j _(p)),(i _(p) +l−1,j _(p))(i _(p) +l,j _(p)))+{circumflex over (φ)}₁((i _(p) +s−2,j _(p))(i _(p) +s−1,j _(p)),(i _(p) +s−1,j _(p))(i _(p) +S,j _(p)+1))+{circumflex over (φ)}₁((i _(p) +s−1,j _(p))(i _(p) +s,j _(p)+1),(i _(p) +s,j _(p)+1)(i _(p) +s,j _(p)+2)) S _(W) =S _({acute over (W)}) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₎ +h _(d)+(s−3)h _(h)+κ(x _(i) _(p) _(+s) ,y _(p+1))+v _(d) ρ(C)−σ(A)≤ S _(W) _(ρ(C)) −S _(W) ≤S _({acute over (W)}) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎ +v _(u)+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(d)+(s−2)h _(h)−( S _({acute over (W)}) _(ρ(C)) _(((i) _(p−1) _(,j) _(p−1) ₎₎+κ((x _(i) _(p) ₊₁ ,y _(j) _(p) )+h _(d)+(s−3)h _(h)+κ(x _(i) _(p) _(+s) ,y _(p+1))+v _(d)) ρ(C)−σ(A)≤v _(u)+κ(x _(i) _(p) ₊₁ ,y _(j) _(p) ₊₁)+h _(h)−κ(x _(i) _(p) ₊₁ ,y _(j) _(p) )−κ(x _(i) _(p) _(+s) ,y _(p+1))−v _(d)

Case 2) C=(0,0)

We have ρ(C)=0 by definition. A=(0,1), σ(A)=v, and ρ(C)−σ(A)=0−v, ρ(C)−σ(A)=−v. We obtain an overall upper bound based on the upper bounds above.

Local Alignment

affine modified simplified Lemma 2.3 0 0 0 lower bound Lemma 2.3 α + β max{0, α + β, κ_(max) − κ_(min) + α + β upper bound (α + β), κ_(max) − 2κ_(min) + α − β}

Local Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 2.3 0 0 0 lower bound Lemma 2.3 α + β max{κ_(max) − κ_(min) + (α + β), α + β upper bound κ_(max) − 2κ_(min) + α − β}

E. Lemma WT

We are given a vertex, A, A∈

and A≠(0,0) and a walk W_(ρ(A))=((i₀,j₀), (i₁,j₁), . . . , (i_(k),j_(k))). Now if k>1, then (i₀,j₀)(i₁,j₁)∈A^(d).

We are also given that (i) score gap constants are negative and (ii) symmetric:

Just h=v is enough no need for h^(d)=v^(d), h=v^(h), and h^(v)=v^(v).

Proof:

Given ρ(A)=S _(W) _(ρ(A)) ={circumflex over (φ)}₀((i₀,j₀)(i₁,j₁))+Σ_(t=2) ^(k){circumflex over (φ)}₁((i_(t−2),j_(t−2))(i_(t−1),j_(t−1)), (i_(t−1),j_(t−1))(i_(t),j_(t))) and we have {circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))=h<0for(i ₀ ,j ₀)(i ₁ ,j ₁)∈A ^(h)and {circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))=v<0for(i ₀ ,j ₀)(i ₁ ,j ₁)∈A ^(v).

if (i₀,j₀)(i₁,j₁)∉A^(d), then we will show below that S _(W)>S _(W) _(ρ(A)) , where walk W is ((i₁,j₁), . . . , (i_(k),j_(k))). S _(W) −S _(W) _(ρ(A)) ={circumflex over (φ)}₀((i ₁ ,j ₁)(i ₂ ,j ₂))+Σ_(t=3) ^(k){circumflex over (φ)}₁((i _(t−2) ,j _(t−2))(i _(t−1) ,j _(t−1)),(i _(t−1) ,j _(t−1))(i _(t) ,j _(t)))−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))−Σ_(t=2) ^(k){circumflex over (φ)}₁((i _(t−2) ,j _(t−2))(i _(t−1) ,j _(t−1)),(i _(t−1) ,j _(t−1))(i _(t) ,j _(t)))={circumflex over (φ)}₀((i ₁ ,j ₁)(i ₂ ,j ₂))+Σ_(t=3) ^(k){circumflex over (φ)}₁((i _(t−2) ,j _(t−2))(i _(t−1) ,j _(t−1)),(i _(t−1) ,j _(t−1))(i _(t) ,j _(t)))−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{circumflex over (φ)}₁((i ₀ ,j ₀)(i ₁ ,j ₁),(i ₁ ,j ₁)(i ₂ ,j ₂))−Σ_(t=3) ^(k){circumflex over (φ)}₁((i _(t−2) ,j _(t−2))(i _(t−1) ,j _(t−1)),(i _(t−1) ,j _(t−1))(i _(t) ,j _(t))) S _(W) −S _(W) _(ρ(A)) ={circumflex over (φ)}₀((i ₁ ,j ₁)(i ₂ ,j ₂))−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{circumflex over (φ)}₁((i ₀ ,j ₀)(i ₁ ,j ₁),(i ₁ ,j ₁)(i ₂ ,j ₂))

if (i₁,j₁)(i₂,j₂)∈A^(d), then {circumflex over (φ)}₀((i ₁ ,j ₁)(i ₂ ,j ₂))−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{circumflex over (φ)}₁((i ₀ ,j ₀)(i ₁ ,j ₁),(i ₁ ,j ₁)(i ₂ ,j ₂))=−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁)) and S _(W) −S _(W) _(ρ(A)) =−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))>0

if (i₁,j₁)(i₂,j₂)∈A^(h), then {circumflex over (φ)} ₀((i ₁ ,j ₁)(i ₂ ,j ₂))−{circumflex over (φ)} ₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{circumflex over (φ)} ₁((i ₀ ,j ₀)(i ₁ ,j ₁),(i ₁ ,j ₁)(i ₂ ,j ₂))=h−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{h ^(d) ,h ^(h), or h ^(v) }=h−{circumflex over (φ)} ₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{h ^(d) ,h ^(h), or h ^(v)} and S _(W) −S _(W) _(ρ(A)) =−{h ^(d) ,h ^(h), or h ^(v)}>0

if (i₁,j₁)(i₂,j₂)∈A^(v), then {circumflex over (φ)} ₀((i ₁ ,j ₁)(i ₂ ,j ₂))−{circumflex over (φ)} ₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{circumflex over (φ)} ₁((i ₀ ,j ₀)(i ₁ ,j ₁),(i ₁ ,j ₁)(i ₂ ,j ₂))=v−{circumflex over (φ)}₀((i ₀ ,j ₀)(i ₁ ,j ₁))−{v ^(d) ,v ^(h), or v ^(v)} and S _(W) −S _(W) _(ρ(A)) =−{v ^(d) ,v ^(h), or v ^(v)}>0

F. Lemmas 3.3-7.3

Given the upper and lower bounds in Lemmas 1 and 2 for local alignment, we drive four more set of lower and upper bounds. We have six vertices X, Y, A, B, C, and D. A is immediately above C, and X is immediately above A. D is immediately to the right of C, B is immediately to the right of A, and Y is immediately to the right of X.

Proof:

Local Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 1.3 −α − β min{−α − β, κ_(min) + β} −α − β upper bound L₁ Lemma 1.3 κ_(max) + α + β max{κ_(max) + α + β, −β + κ_(max) + α + β upper bound κ_(max) − κ_(min)} U₁

Local Alignment: κ_(min)≤0 and κ_(max)≥0

affine modified simplified Lemma 2.3 0 0 0 upper bound L₂ Lemma 2.3 α + β max{κ_(max) − κ_(min) + (α + β), α + β upper bound κ_(max) − 2κ_(min) + α − β} U₂

The rest is exactly the same as the global case.

Lemma 1.3 L₁ ≤ ρ(B) − ρ(A) ≤ U₁ L₁ ≤ ρ(C) − ρ(A) ≤ U₁ Lemma 2.3 L₂ ≤ ρ(B) − σ(D) ≤ U₂ L₂ ≤ ρ(C) − τ(D) ≤ U₂ Lemma 3.3 L₃ = L₁ + L₂ ≤ ρ(B) − σ(B) ≤ U₁ + U₂ = U₃ L₃ = L₁ + L₂ ≤ ρ(C) − σ(C) ≤ U₁ + U₂ = U₃ Lemma 4.3 −U₁ + L₃ ≤ ρ(A) − σ(B) ≤ −L₁ + U₃ −U₁ + L₃ ≤ ρ(A) − σ(C) ≤ −L₁ + U₃ Lemma 5.3 −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ Lemma 6.3 L₁ − U₁ + L₃ ≤ ρ(B) − τ(C) ≤ U₁ − L₁ + U₃ L₁ − U₁ + L₃ ≤ ρ(C) − σ(B) ≤ U₁ − L₁ + U₃

1. Lemma 3.3:

$\begin{matrix} {{{\rho(B)} - {\sigma(B)}} =} \\ {{{\rho(B)} - {\rho(Y)} + {\rho(Y)} - {\sigma(B)}} =} \\ {{T1} + {T2}} \\ {{L_{1} + L_{2}} \leq {{\rho(B)} - {\sigma(B)}} \leq {U_{1} + U_{2}}} \end{matrix}$

Lemma 4.3:

$\begin{matrix} {{{\rho(A)} - {\sigma(B)}} =} \\ {{{\rho(A)} - {\rho(B)} + {\rho(B)} - {\sigma(B)}} =} \\ {{{- T}1} + {T3}} \\ {{{- U_{1}} + L_{3}} \leq {{\rho(A)} - {\sigma(B)}} \leq {{- L_{1}} + U_{3}}} \end{matrix}$

Lemma 5.3:

$\begin{matrix} {{{\rho(B)} - {\rho(C)}} =} \\ {{{\rho(B)} - {\rho(A)} + {\rho(A)} - {\sigma(C)}} =} \\ {{T1} - {T3}} \\ {{{- U_{1}} + L_{1}} \leq {{\rho(B)} - {\rho(C)}} \leq {{- L_{1}} + U_{1}}} \end{matrix}$

Lemma 6.3:

$\begin{matrix} {{{\rho(B)} - {\tau(C)}} =} \\ {{{\rho(B)} - {\rho(A)} + {\rho(A)} - {\rho(C)} + {\rho(C)} - {\sigma(C)}} =} \\ {{T1} - {T1} + {T3}} \\ {{L_{1} - U_{1} + L_{3}} \leq {{\rho(B)} - {\tau(C)}} \leq {U_{1} - L_{1} + U_{3}}} \end{matrix}$

For Affine (Gotoh) gap score, we generate the table below based on above results.

Gotoh L ₁=−(α+β) U ₁=κ_(max)+α+β,κ_(max)≥0 L ₂=0 U ₂=(α+β)

Lemma 1.3 −(α + β) ≤ ρ(B) − ρ(A) ≤ κ_(max) + (α + β) −(α + β) ≤ ρ(C) − ρ(A) ≤ κ_(max) + (α + β) Lemma 2.3 0 ≤ ρ(B) − σ(D) ≤ (α + β) 0 ≤ ρ(C) − τ(D) ≤ (α + β) Lemma 3.3 −(α + β) ≤ ρ(B) − σ(B) ≤ κ_(max) + 2(α + β) −(α + β) ≤ ρ(C) − σ(C) ≤ κ_(max) + 2(α + β) Lemma 4.3 −κ_(max) − 2(α + β) ≤ ρ(A) − σ(B) ≤ κ_(max) + 3(α + β) −κ_(max) − 2(α + β) ≤ ρ(A) − σ(C) ≤ κ_(max) + 3(α + β) Lemma 5.3 −κ_(max) − 2(α + β) ≤ ρ(B) − ρ(C) ≤ κ_(max) + 2(α + β) −κ_(max) − 2(α + β) ≤ ρ(B) − ρ(C) ≤ κ_(max) + 2(α + β) Lemma 6.3 −κ_(max) − 3(α + β) ≤ ρ(B) − τ(C) ≤ 2κ_(max) + 4(α + β) −κ_(max) − 3(α + β) ≤ ρ(C) − σ(B) ≤ 2κ_(max) + 4(α + β)

We repeat the above to obtain Lemma 4.3-6.3 for the simplified and modified versions.

Lemma 7.3: The difference of any pair of values 1)-5) below is in the interval:

[LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)},and κ_(max)≥0

1) ρ(A)+κ(B)

2) ρ(B)−(α+β)

3) σ(B)−β

4) ρ(C)−(α+β)

5) τ(C)−β

Proof:

Difference of 1) and 2): from Lemmas 1.3-6.3 (α+β)≤ρ(B)−ρ(A)≤κ_(max)+(α+β) −(α+β)−(α+β)−κ(B)≤(ρ(B)−(α+β))−(ρ(A)+κ(B))≤κ_(max)+(α+β)−(α+β)−κ(B) −2(α+β)−κ(B)≤(ρ(B)−(α+β))−(ρ(A)+m)≤κ_(max)−κ(B) −2(α+β)−κ_(max)(ρ(B)−(α+β))−(ρ(A)+κ(B))≤κ_(max)−κ_(min)

Difference of 1) and 3): from Lemmas 1.3-6.3 −κ_(max)−2(α+β)≤ρ(A)−σ(B)≤κ_(max)+3(α+β) −κ_(max)−2(α+β)+κ(B)+β≤(ρ(A)+κ(B))−(σ(B)−β)≤κ_(max)+3(α+β)+κ(B)+β −κ_(max)−2(α+β)+κ_(min)+β≤(ρ(A)+κ(B))−(σ(B)−β)≤2κ_(max)+3(α+β)+β

Difference of 1) and 4): Same as difference of 1) and 2)

Difference of 1) and 5): Same as difference of 1) and 3)

Difference of 2) and 3): from Lemmas 1.3-6.3 −(α+β)≤ρ(B)−σ(B)≤κ_(max)+2(α+β) −(α+β)−(α+β)+β≤(ρ(B)−(α+β))−(σ(B)−β)≤κ_(max)+2(α+β)−(α+β)+β −2(α+β)+β≤(ρ(B)−(α+β))−(σ(B)−β)≤κ_(max)+(α+β)+β

Difference of 2) and 4): from Lemmas 1.3-6.3 −κ_(max)−2(α+β)≤ρ(B)−ρ(C)≤κ_(max)+2(α+β) −κ_(max)−2(α+β)≤(ρ(B)−(α+β))−(ρ(C)−(α+β))≤κ_(max)+2(α+β) −κ_(max)−2(α+β)≤(ρ(B)−(α+β))−(ρ(C)−(α+β))≤κ_(max)+2(α+β)

Difference of 2) and 5): from Lemmas 1.3-6.3 −κ_(max)−3(α+β)≤ρ(B)−τ(C)≤2κ_(max)+4(α+β) −κ_(max)−3(α+β)−(α+β)+β≤(ρ(B)−(α+β))−(τ(C)−β)≤2κ_(max)+4(α+β)−(α+β)+β −κ_(max)−4(α+β)+β≤(ρ(B)−(α+β))−(τ(C)−β)≤2κ_(max)+3(α+4(α+β)−(α+β)+β

Difference of 3) and 4): Same as 2) and 5)

Difference of 3) and 5): from Lemmas 1.3-63 2κ_(max)+5(α+β)≤σ(B)−β−(τ(C)−β)=σ(B)−τ(C)≤2κ_(max)+5(α+β)

Difference of 4) and 5): Same as 2) and 3)

An interval that contains all the bounds is [LB UB], where, LB=min{−2κ_(max)−5(α+β),−κ_(max)−2(α+β)+κ_(min)+β} UB=max{2κ_(max)+5(α+β),κ_(max)−κ_(min)},and κ_(max)≥0

We repeat Lemma 7.3 for simplified and modified similarly.

We use the bound for values 1)-5) that include the score of the arcs.

1′) ρ(A)+κ(B). 2′) ρ(B)−(α+β). 3′) σ(B)−β. 4′) ρ(C)−(α+β. 5′) τ(C)−β

Alternatively, it is possible to use a similar bound for values 1′)-5′) that do not include the score of the arcs. The overall expressions in of the recursion must be reduced to a modulus based on the bound we use.

VII. Banded Local Alignment Proof

To prove that the local alignment results apply to the banded local alignment it suffices to show that in the following lemmas we have the proper covering, as mentioned in for global and overlapping cases.

Lemma 1.3—Lower-Bound:

Briefly, in all cases resulting a lower bound to ρ(A)−ρ(B), we have a walk, W, to A and W_(ρ(B))=((i₀,j₀), (i₁,j₁), . . . , (i_(s),j_(s))=B). Further we have W=(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s) ,j _(s))((i _(A) ,j _(A))) or W=(i ₀ ,j ₀),(i ₁ ,j ₁), . . . ,(i _(s−1) ,j _(s−1))((i _(A) ,j _(A))).

Therefore, since A and B are in the BAND, if W_(ρ(B)) is in the BAND so is W.

Lemma 1.3—Upper-Bound:

1) We assume A, B and {circumflex over (ρ)}(A) belong to the BAND.

2) Now, given that the sequence denoted by (a) is in the BAND, then the sequence (n) is in the BAND because all its vertices belong to the diagonals that pass through {the vertices of (α)}U{B}.

With the same argument, given sequences denoted by (b), (c), (d), (e), (f), (g), (h), (i), (j), (k), and (l) are in the BAND, then the sequences

(o), (p), (q), (n), (o), (p), (q), (r), (s), (t), and (u) are in the BAND, respectively.

For the same reason, if (m)U{B} is in the BAND, then (i) is the BAND, where (i) is the vertical arc ending in B.

Again for the same reason, if (v), (w), (x), and (y) are in the BAND and B is in the BAND, then AA, BB, CC, and DD are in the band.

Lemma 2.3—Lower-Bound:

if W_(σ(A))

((i₀,j₀), (i₁,j₁), . . . , (i_(s−1),j_(s−1)), (i_(s−1),j_(s−1)+1)) is in the BAND, then ((i₀,j₀), (i₁,j₁), . . . , (i_(s−1),j_(s−1))) is in the BAND.

Lemma 2.3—Upper-Bound:

We have W_(ρ(C))

((i₀,j₀), (i₁,j₁), . . . , (i_(s−1),j_(s−1)), (i_(s),j_(s))), for s≥1.

Define W1

W_(ρ(C))*((i_(s),j_(s)+1))

If W1 is the walk to A and if W_(ρ(C)) is in the BAND and A is in the BAND=>W1 is in the BAND done.

Briefly,

In Sub-subcase 1.b.a) part 1: if W_(ρ(C)) and A are in the BAND so is W.

In Sub-subcase 1.b.a) part 2: if W_(ρ(C)) and A are in the BAND so is W.

In Sub-subcase 1.b.a) part 3: if W_(ρ(C)) and A are in the BAND so is W.

VIII. Simplified and Modified Gap Scores

In several embodiments described above, the affine gap score is used as an example. Other embodiments may use a simplified or a modified gap score. The same parameters: κ_(max)=15, κ_(min)=−5, α=10, and β=1 are used in the following examples.

The followings describe the use of the simplified gap score:

step 1) the lower and upper bounds of Lemma 1.1 are the same for affine and simplified gap scores.

step 2) the lower and upper bounds of Lemma 2.1 are the same for affine and simplified gap scores.

step 3) therefore the lower and upper bounds of Lemmas 3.1-7.1 are the same for affine and simplified gap scores.

step 4) thus the Q of Lemma 7.1 is the same for affine and simplified gap scores. Thus, Q=85, see the first example.

step 5) the same modulus

=2Q+1=171, may be selected for simplified gap score.

step 6) in the first embodiment, when we use simplified gap score instead of affine gap score, the same 8 bits representation is selected for each r₁-r₅.

The followings describe the use of the modified gap score:

step 1) the lower and upper bounds of Lemma 1.1 are not the same for affine and modified gap scores.

step 2) the lower and upper bounds of Lemma 2.1 are not the same for affine and modified gap scores.

step 3) generate upper and lower bounds for each difference of a pair of distinct terms of ρ(A)+κ(B), ρ(B)−(α+β), σ(B)−β, ρ(C)−(α+β), and τ(C)−β based on the bounds below.

Lemma 1.1 L₁ ≤ ρ(B) − ρ(A) ≤ U₁ L₁ ≤ ρ(C) − ρ(A) ≤ U₁ Lemma 2.1 L₂ ≤ ρ(B) − σ(D) ≤ U₂ L₂ ≤ ρ(C) − τ(D) ≤ U₂ Lemma 3.1 L₃ = L₁ + L₂ ≤ ρ(B) − σ(B) ≤ U₁ + U₂ = U₃ L₃ = L₁ + L₂ ≤ ρ(C) − σ(C) ≤ U₁ + U₂ = U₃ Lemma 4.1 −U₁ + L₃ ≤ ρ(A) − σ(B) ≤ −L₁ + U₃ −U₁ + L₃ ≤ ρ(A) − σ(C) ≤ −L₁ + U₃ Lemma 5.1 −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ −U₁ + L₁ ≤ ρ(B) − ρ(C) ≤ −L₁ + U₁ Lemma 6.1 L₁ − U₁ + L₃ ≤ ρ(B) − τ(C) ≤ U₁ − L₁ + U₃ L₁ − U₁ + L₃ ≤ ρ(C) − σ(B) ≤ U₁ − L₁ + U₃

Difference of 1) and 2): −U ₁ +L ₃−(α+β)−κ_(max) ≤−U ₁ +L ₃−(α+β)−κ(B)≤ρ(A)−(α+β)−σ(B)−κ(B)≤−L ₁ +U ₃−(α+β)−κ(B)≤−L ₁ +U ₃−(α+β)−κ_(min) −U ₁ +L ₃−(α+β)−κ_(max)≤ρ(A)−(α+β)−σ(B)−κ(B)≤−L ₁ +U ₃−(α+β)−κ_(min)

Difference of 1) and 3): −U ₁ +L ₃+κ_(min) +β≤−U ₁ +L ₃+κ(B)+β≤ρ(A)+κ(B)−(σ(B)+β≤−L ₁ +U ₃+κ(B)+β≤−L ₁ +U ₃+κ_(max)+β −U ₁ +L ₃+κ_(min)+β≤ρ(A)+κ(B)−σ(B)+β≤−L ₁ +U ₃+κ_(max)+β

Difference of 1) and 4): same as Difference of 1) and 2).

Difference of 1) and 5): same as Difference of 1) and 3).

Difference of 2) and 3): L ₁ +L ₂−(α+β)+β≤ρ(B)−(α+β)−σ(B)+β≤U ₁ +U ₂−(α+β)+β

Difference of 2) and 4): −U ₁ +L ₁≤ρ(B)−ρ(C)≤−L ₁ +U ₁ −U ₁ +L ₁−(α+β)+(α+β)≤ρ(B)−(α+β)−ρ(C)+(α+β)≤−L ₁ +U ₁−(α+β)+(α+β) −U ₁ +L ₁≤ρ(B)−(α+β)−ρ(C)+(α+β)≤−L ₁ +U ₁

Difference of 2) and 5): L ₁ −U ₁ +L ₃≤ρ(B)−τ(C)≤U ₁ −L ₁ +U ₃ L ₁ −U ₁ +L ₃−(α+β)+β≤ρ(B)−(α+β)−τ(C)+β≤U ₁ −L ₁ +U ₃−(α+β)+β L ₁ −U ₁ +L ₃−α≤ρ(B)−(α+β)−τ(C)+β≤U ₁ −L ₁ +U ₃−α

Difference of 3) and 4): same as Difference of 2) and 5).

Difference of 3) and 5): X=(τ(C)−β)−(σ(B)−β)=((ρ(A)+κ(B))−(σ(B)−β))−((ρ(A)+κ(B))−(τ(C)−β))=diff(1,3)−diff(1,5) −U ₁ +L ₃+κ_(min)+β≤ρ(A)+κ(B)−σ(B)+β≤−L ₁ +U ₃+κ_(max)+β −U ₁ +L ₃+κ_(min)+β−(−L ₁ +U ₃+κ_(max)+β)≤X≤−L ₁ +U ₃+κ_(max)+β−(−U ₁ +L ₃+κ_(min)+β) −U ₁ −U ₃ +L ₃ +L ₁+κ_(min)−κ_(max) ≤X≤−L ₁ −L ₃ +U ₃ +U ₁+κ_(max)−κ_(min)

Difference of 4) and 5): same as Difference of 2) and 3).

step 4) Use the same parameters: κ_(max)=15, κ_(min)=−5, α=10, and β=1, we evaluate the bounds of the differences:

Difference of 1) and 2): [−42 67] −43≤ρ(A)−(α+β)−σ(B)−κ(B)≤67

Difference of 1) and 3): [−41 89] −41≤ρ(A)+κ(B)−σ(B)+β≤89

Difference of 1) and 4): same as Difference of 1) and 2).

Difference of 1) and 5): same as Difference of 1) and 3).

Difference of 2) and 3): [−21 52] −21≤ρ(B)−(α+β)−σ(B)+β≤52

Difference of 2) and 4): [−37 37] −37≤ρ(B)−(α+β)−ρ(C)+(α+β)≤37

Difference of 2) and 5): [−58 89] −58≤ρ(B)−(α+β)−τ(C)+β≤89

Difference of 3) and 4): same as Difference of 2) and 5).

Difference of 3) and 5): [−130 130] −130≤(τ(C)−β)−(σ(B)−β)≤130

Difference of 4) and 5): same as Difference of 2) and 3).

step 5) we pick, u-max, the largest upper bound, and 1-min, the smallest lower bound.

u-max=130. 1-min=−130. And we pick Q=maximum({magnitude(u-max)=130, magnitude(1-min)=130})=130.

step 6) we use modulus

=2Q+1=2*130+1=261, for modified gap score.

step 7) in the first embodiment, when we use modified gap score instead of affine gap score, the need 9 bits representations for each r₁-r₅, instead of 8 bits because 9>log 2(261)>8.

A. Minimal Formulation

In some cases, the goal of an alignment is to minimize a distance between two sequences instead of maximizing a score. There is usually an equivalence between distance and score (or similarity) measures or values on sequence, in the sense that a distance values equivalent to a score values produces the same optimal alignments. See “On order equivalences between distance and similarity measures on sequences and trees” by Martin Emms and Hector-Hugo Franco-Penya, School of Computer Science and Statistics, Trinity College, Dublin, Ireland.

When such an equivalence exists, the minimization problem of a distance may be translated to the maximization problem of its equivalent score. And apply the solutions given in this disclosure.

Further, the following changes in the formulations of this disclosure will apply to problems of minimization of a distance.

All the parameters of key recursive equations are redefined to point to paths with least score instead of maximum score. For example, ρ(A) denotes the least (instead of the maximum) score over all allowable paths ending on vertex A.

All the Lemmas 1-7, will have upper and lower bounds reversed, and κ_(max) and κ_(min) interchanged.

In a first aspect, a computing device for aligning genetic material sequences is provided. The computing device comprises a processor comprising a plurality of processor registers. The processor is configured to receive first and second genetic material sequences, each genetic material sequence comprising a plurality of bases of a genetic base alphabetic. The processor is configured to augment a beginning of each of the first and second genetic material sequence with an auxiliary base not in the genetic base alphabet. The processor is configured to define a two-dimensional matrix comprising a plurality of rows and columns, each row having a length equal to a number of bases in the augmented first genetic material sequence, each column having a length equal to a number of bases in the augmented second genetic material sequence, the matrix comprising a plurality of nodes arranged in a two-dimensional positional order comprising a first node located at an intersection of a first row and a first column of the matrix, and a last node located at an intersection of a last row and a last column of the matrix, each node of the matrix corresponding to a base from the augmented first genetic material sequence and a base from the augmented second genetic material sequence. The processor is configured to compute a first integer value as a function of a substitution value matrix and a plurality of gap score constants. The processor is configured to initialize first, second, and third scores of the first node of the matrix to a set of known values. The processor is configured to, for each node of the matrix other than the first node: compute a first residue of a first score of the node based on a plurality of residue of scores of a node in a previous positional order in a same column of the matrix as the node modulo the first integer value; store the first residue of the first score of the node in a processor register of the plurality of processor registers; compute a second residue of a second score of the node based on a plurality of residue of scores of a node in a previous positional order in a same row of the matrix as the node modulo the first integer value; store the second residue of the second score of the node in a processor register of the plurality of processor registers; compute a third residue of a third score of the node based on a residue of a score of a node in a previous positional order in a same diagonal of the matrix as the node modulo the first integer value and a plurality of residue of the scores of the node modulo the first integer value; and store the third residue of the third score of the node in a processor register of the plurality of processor registers.

In an embodiment of the first aspect, the first integer value is calculated as function of a maximum of the substitution score map, a minimum of the substitution score map, and one or more gap score constants in the plurality of gap score constants.

In another embodiment of the first aspect, the plurality of residue of scores of the node in the previous positional order in the same column of the matrix comprises the first residue and the third residue of the previous node in the same column of the matrix.

In another embodiment of the first aspect, the plurality of residue of scores of the node in the previous positional order in the same row of the matrix comprises the second residue and the third residue of the previous node in the same row of the matrix.

In another embodiment of the first aspect, the residue of the score of the node in the previous positional order in the same diagonal of the matrix as the node comprises the third residue of the previous node diagonally located in the matrix, and wherein the plurality of residue of the scores of the node comprise the first and second residues of the node.

In another embodiment of the first aspect, the substitution score map comprises a set of score values for matches and mismatches of the bases in the genetic base alphabet, and wherein and the plurality of gap score constants comprises a set of score values for gaps between aligned bases of the augmented first and second genetic material sequences.

In a second aspect, a method of optimizing computer storage requirements for aligning two genetic material sequences is provided. The method is performed by a processor of a computing device, where the processor comprises a plurality of processor registers. The method comprises receiving first and second genetic material sequences, each genetic material sequence comprising a plurality of bases of a genetic base alphabetic. The method comprises augmenting a beginning of each of the first and second genetic material sequence with an auxiliary base not in the genetic base alphabet. The method comprises defining a two-dimensional matrix comprising a plurality of rows and columns, each row having a length equal to a number of bases in the augmented first genetic material sequence, each column having a length equal to a number of bases in the augmented second genetic material sequence, the matrix comprising a plurality of nodes arranged in a two-dimensional positional order comprising a first node located at an intersection of a first row and a first column of the matrix, and a last node located at an intersection of a last row and a last column of the matrix, each node of the matrix corresponding to a base from the augmented first genetic material sequence and a base from the augmented second genetic material sequence. The method comprises computing a first integer value as a function of a substitution value matrix and a plurality of gap score constants. The method comprises initializing first, second, and third scores of the first node of the matrix to a set of known values. The method comprises, for each node of the matrix other than the first node, computing a first residue of a first score of the node based on a plurality of residue of scores of a node in a previous positional order in a same column of the matrix as the node modulo the first integer value; storing the first residue of the first score of the node in a processor register of the plurality of processor registers; computing a second residue of a second score of the node based on a plurality of residue of scores of a node in a previous positional order in a same row of the matrix as the node modulo the first integer value; storing the second residue of the second score of the node in a processor register of the plurality of processor registers; computing a third residue of a third score of the node based on a residue of a score of a node in a previous positional order in a same diagonal of the matrix as the node modulo the first integer value and a plurality of residue of the scores of the node modulo the first integer value; and storing the third residue of the third score of the node in a processor register of the plurality of processor registers.

In an embodiment of the second aspect, the first integer value is calculated as function of a maximum of the substitution score map, a minimum of the substitution score map, and one or more gap score constants in the plurality of gap score constants.

In another embodiment of the second aspect, the plurality of residue of scores of the node in the previous positional order in the same column of the matrix comprises the first residue and the third residue of the previous node in the same column of the matrix.

In another embodiment of the second aspect, the plurality of residue of scores of the node in the previous positional order in the same row of the matrix comprises the second residue and the third residue of the previous node in the same row of the matrix.

In another embodiment of the second aspect, the residue of the score of the node in the previous positional order in the same diagonal of the matrix as the node comprises the third residue of the previous node diagonally located in the matrix, and wherein the plurality of residue of the scores of the node comprise the first and second residues of the node.

In another embodiment of the second aspect, the substitution score map comprises a set of score values for matches and mismatches of the bases in the genetic base alphabet, and wherein and the plurality of gap score constants comprises a set of score values for gaps between aligned bases of the augmented first and second genetic material sequences.

In a third aspect, a computer readable media storing a program for optimizing computer storage requirements for aligning two genetic material sequences is provided. The program is executable by a processor of a computing device, where the processor comprises a plurality of processor registers. The program comprises a set of instructions for receiving first and second genetic material sequences, each genetic material sequence comprising a plurality of bases of a genetic base alphabetic. The program comprises a set of instructions for augmenting a beginning of each of the first and second genetic material sequence with an auxiliary base not in the genetic base alphabet. The program comprises a set of instructions for defining a two-dimensional matrix comprising a plurality of rows and columns, each row having a length equal to a number of bases in the augmented first genetic material sequence, each column having a length equal to a number of bases in the augmented second genetic material sequence, the matrix comprising a plurality of nodes arranged in a two-dimensional positional order comprising a first node located at an intersection of a first row and a first column of the matrix, and a last node located at an intersection of a last row and a last column of the matrix, each node of the matrix corresponding to a base from the augmented first genetic material sequence and a base from the augmented second genetic material sequence. The program comprises a set of instructions for computing a first integer value as a function of a substitution value matrix and a plurality of gap score constants. The program comprises a set of instructions for initializing first, second, and third scores of the first node of the matrix to a set of known values. The program comprises a set of instructions for each node of the matrix other than the first node for, computing a first residue of a first score of the node based on a plurality of residue of scores of a node in a previous positional order in a same column of the matrix as the node modulo the first integer value; storing the first residue of the first score of the node in a processor register of the plurality of processor registers; computing a second residue of a second score of the node based on a plurality of residue of scores of a node in a previous positional order in a same row of the matrix as the node modulo the first integer value; storing the second residue of the second score of the node in a processor register of the plurality of processor registers; computing a third residue of a third score of the node based on a residue of a score of a node in a previous positional order in a same diagonal of the matrix as the node modulo the first integer value and a plurality of residue of the scores of the node modulo the first integer value; and storing the third residue of the third score of the node in a processor register of the plurality of processor registers.

As used in this specification, the terms “computer,” “server,” “processor,” “processing unit,” “controller,” and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms display or displaying means displaying on an electronic device. As used in this specification, the terms “computer readable medium,” “computer readable media,” and “machine readable medium” are entirely restricted to non-transitory, tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral or transitory signals.

The above description presents the best mode contemplated for carrying out the present embodiments, and of the manner and process of practicing them, in such full, clear, concise, and exact terms as to enable any person skilled in the art to which they pertain to practice these embodiments. The present embodiments are, however, susceptible to modifications and alternate constructions from those discussed above that are fully equivalent. Consequently, the present invention is not limited to the particular embodiments disclosed. On the contrary, the present invention covers all modifications and alternate constructions coming within the spirit and scope of the present disclosure. For example, the steps in the processes described herein need not be performed in the same order as they have been presented and may be performed in any order(s). Further, steps that have been presented as being performed separately may in alternative embodiments be performed concurrently. Likewise, steps that have been presented as being performed concurrently may in alternative embodiments be performed separately. 

What is claimed is:
 1. A computing device for aligning genetic material sequences, the computing device comprising: a first function generator comprising first, second, and third adders, a first inverter, and a first multiplexer; a second function generator comprising fourth, fifth, and sixth adders, a second inverter, and a second multiplexer; a third function generator comprising a seventh adder, a comparator, and a third multiplexer; and a processor configured to: receive first and second genetic material sequences, each genetic material sequence comprising a plurality of bases of a genetic base alphabet; augment a beginning of each of the first and second genetic material sequence with an auxiliary base not in the genetic base alphabet; define a two-dimensional matrix comprising a plurality of rows and columns, each row having a length equal to a number of bases in the augmented first genetic material sequence, each column having a length equal to a number of bases in the augmented second genetic material sequence, the matrix comprising a plurality of nodes arranged in a two-dimensional positional order comprising a corner node located at an intersection of a first row and a first column of the matrix, and a last node located at an intersection of a last row and a last column of the matrix, each node of the matrix corresponding to a base from the augmented first genetic material sequence and a base from the augmented second genetic material sequence; initialize first, second, and third scores of the corner node of the matrix to a set of known values; for each node of the matrix other than the corner node: the first function generator configured to: add, at the first adder, a residue of a first score of a first node in a previous positional order in a same column of the matrix as the node, to a residue of a first gap score constant; add, at the second adder, a residue of a second score of the first node to a residue of a second gap score constant; and select, by the third adder, the first inverter, and the first multiplexer, a residue of a smaller of the first score of the first node plus the first gap score constant, and the second score of the first node plus the second gap score constant as a residue of a first score of the node; the second function generator configured to: add, at the fourth adder, a residue of a first score of a second node in a previous positional order in a same row of the matrix as the node to a third gap score constant; add, at the fifth adder, a residue of a second score of the second node to a fourth gap score constant; and select, by the sixth adder, the second inverter, and the second multiplexer, a residue of a smaller of the first score of the second node plus the third gap score constant, and the second score of the second node plus the fourth gap score constant as a residue of a second score of the node; the third function generator configured to: add, at the seventh adder, a residue of a score of a third node in a previous positional order in a same diagonal of the matrix as the node to a residue of a substitution value associated with the third node and the node; and select, by the comparator and the third multiplexer, a residue of a smallest of (i) the first score of the node, (ii) the second score of the node, and (iii) the score of the third node plus the substitution value as a residue of a third score of the node; the processor further configured to: perform a recursive traceback on the two-dimensional matrix starting with the last node and ending to the corner node to compute a maximal score walk on the two-dimensional matrix based on the residue of the first score of the plurality of nodes of the two-dimensional matrix, the residue of the second score of the plurality of nodes of the two-dimensional matrix, and the residue of the third score of the plurality of nodes of the two-dimensional matrix; and align the first and second genetic material sequences using the maximal score walk.
 2. The computing device of claim 1, wherein the processor of the computing device is configured to compute a first integer value as function of a substitution value matrix and a plurality of gap score constants; and wherein the first, second, and third function generators of the computing device are configured to: receive the first integer value; and perform residue computations as modulo operations over the first integer value.
 3. The computing device of claim 1, wherein the residue of the first score of the first node in the previous positional order in the same column of the matrix comprises a residue of a cost of traversing the two-dimensional matrix from the corner node to a fourth node in a previous positional order in a same column of the matrix as the first node plus a cost of travelling in a vertical direction from the fourth node to the first node, and wherein the residue of the second score of the first node comprises a residue of a maximal score of traversing the two-dimensional matrix from the corner node to the first node.
 4. The computing device of claim 1, wherein the residue of the first score of the second node in the previous positional order in the same row of the matrix comprises a residue of a cost of traversing the two-dimensional matrix from the corner node to a fourth node in a previous positional order in a same row of the matrix as the second node plus a cost of travelling in a horizontal direction from the fourth node to the second node, and wherein the residue of the second score of the second node comprises a residue of a maximal score of traversing the two-dimensional matrix from the corner node to the second node.
 5. The computing device of claim 1, wherein the residue of the score of the third node in the previous positional order in the same diagonal of the matrix as the node comprises a residue of a maximal score of traversing the two-dimensional matrix from the corner node to the third node.
 6. The computing device of claim 1, wherein the substitution value comprises one of a set of score values for matches and mismatches of the bases in the genetic base alphabet.
 7. A method of optimizing computer storage requirements for aligning two genetic material sequences, the method comprising: by a processor of a computing device: receiving first and second genetic material sequences, each genetic material sequence comprising a plurality of bases of a genetic base alphabet; augmenting a beginning of each of the first and second genetic material sequence with an auxiliary base not in the genetic base alphabet; defining a two-dimensional matrix comprising a plurality of rows and columns, each row having a length equal to a number of bases in the augmented first genetic material sequence, each column having a length equal to a number of bases in the augmented second genetic material sequence, the matrix comprising a plurality of nodes arranged in a two-dimensional positional order comprising a corner node located at an intersection of a first row and a first column of the matrix, and a last node located at an intersection of a last row and a last column of the matrix, each node of the matrix corresponding to a base from the augmented first genetic material sequence and a base from the augmented second genetic material sequence; initializing first, second, and third scores of the corner node of the matrix to a set of known values; for each node of the matrix other than the corner node: by a first adder of a first function generator of the computing device, adding a residue of a first score of a first node in a previous positional order in a same column of the matrix as the node, to a residue of a first gap score constant; by a second adder of the first function generator of the computing device, adding a residue of a second score of the first node to a residue of a second gap score constant; by a third adder, a first inverter, and a first comparator of the computing device, selecting a residue of a smaller of the first score of the first node plus the first gap score, and the second score of the first node plus the second gap score as a residue of a first score of the node; by a fourth adder of a second function generator of the computing device, adding a residue of a first score of a second node in a previous order in a same row of the matrix as the node to a third gap score constant; by a fifth adder of the second function generator of the computing device, adding a residue of a second score of the second node to a fourth gap score constant; by a sixth adder of the second function generator, second inverter, and a second multiplexer of the computing device, selecting a residue of a smaller of the first score of the second node plus the third gap score, and the second score of the second node plus the fourth gap score as a residue of a second score of the node by a seventh adder of a third function generator of the computing device, adding a residue of a score of a third node in a previous positional order in a same diagonal of the matrix as the node to a residue of a substitution value associated with the third node and the node; and by a comparator and a third multiplexer of the third generator of the computing device, selecting a residue of a smallest of (i) the first score of the node, (ii) the second score of the node, and (iii) the score of the third node plus the substitution value as a residue of a third score of the node; by the processor of the computing device: performing a recursive traceback on the two-dimensional matrix starting with the last node and ending to the corner node to compute a maximal score walk on the two-dimensional matrix based on the residue of the first score of the plurality of nodes of the two-dimensional matrix, the residue of the second score of the plurality of nodes of the two-dimensional matrix, and the residue of the third score of the plurality of nodes of the two-dimensional matrix; and aligning the first and second genetic material sequences using the maximal score walk.
 8. The method of claim 7, further comprising: by the processor of the computing device, computing a first integer value as function of a substitution value matrix and a plurality of gap score constants; and by the first, second, and third function generators of the computing device: receiving the first integer value; and performing residue computations as modulo operations over the first integer value.
 9. The method of claim 7, wherein the residue of the first score of the first node in the previous positional order in the same column of the matrix comprises a residue of a cost of traversing the two-dimensional matrix from the corner node to a fourth node in a previous positional order in a same column of the matrix as the first node plus a cost of travelling in a vertical direction from the fourth node to the first node, and wherein the residue of the second score of the first node comprises a residue of a maximal score of traversing the two-dimensional matrix from the corner node to the first node.
 10. The method of claim 7, wherein the residue of the first score of the second node in the previous positional order in the same row of the matrix comprises a residue of a cost of traversing the two-dimensional matrix from the corner node to a fourth node in a previous positional order in a same row of matrix as the second node plus a cost of travelling in a horizontal direction from the fourth node to the second node, and wherein the residue of the second score of the second node comprises a residue of a maximal score of traversing the two-dimensional matrix from the corner node to the second node.
 11. The method of claim 7, wherein the residue of the score of the third node in the previous positional order in the same diagonal of the matrix as the node comprises a residue of a maximal score of traversing the two-dimensional matrix from the corner node to the third node.
 12. The method of claim 7, wherein the substitution value comprises one of a set of score values for matches and mismatches of the bases in the genetic base alphabet.
 13. The computing device of claim 1, wherein the first, second, third, and fourth gap score constants comprise score values for gaps between aligned bases of the augmented first and second genetic material sequences.
 14. The method of claim 7, wherein the first, second, third, and fourth gap score constants comprise score values for gaps between aligned bases of the augmented first and second genetic material sequences. 